Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,37 @@

## About the example

This example illustrates how to load images in a cell in wpf and uwp treegrid
This example illustrates how to load images in a cell in [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [UWP TreeGrid](https://www.syncfusion.com/uwp-ui-controls/treegrid).

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

## XAML code:

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

## c# code:

``` 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;
}
}
```