Skip to content

This example illustrates how to load images in a cell in wpf and uwp treegrid

SyncfusionExamples/how-to-load-images-in-a-cell-in-wpf-and-uwp-treegrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to load images in a cell in WPF / UWP TreeGrid?

This example illustrates how to load images in a cell in WPF TreeGrid and UWP TreeGrid (SfTreeGrid).

You can add the image to TreeGrid cell by using TreeGridTemplateColumn.

XAML:

<syncfusion:TreeGridTemplateColumn MappingName="ImageLink">
    <syncfusion:TreeGridTemplateColumn.CellTemplate>
          <DataTemplate>
               <Image Source="{Binding Path=ImageLink,
                      Converter={StaticResource converter}}"/>
          </DataTemplate>
    </syncfusion:TreeGridTemplateColumn.CellTemplate>
</syncfusion:TreeGridTemplateColumn>

C#:

public class StringToImageConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        string imagename = value as string;
        return new BitmapImage(new Uri(string.Format(@"..\..\Images\{0}", imagename), UriKind.Relative));
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return null;
    }
}

Load Images in cells

About

This example illustrates how to load images in a cell in wpf and uwp treegrid

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5

Languages