Skip to content

Commit b5ef68e

Browse files
ES-975464 - Resolve the ReadMe file length issue in this sample repository
1 parent 99d85a5 commit b5ef68e

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,37 @@
22

33
## About the example
44

5-
This example illustrates how to load images in a cell in wpf and uwp treegrid
5+
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).
6+
7+
You can add the image to `TreeGrid` cell by using `TreeGridTemplateColumn`.
8+
9+
## XAML code:
10+
11+
``` xml
12+
<syncfusion:TreeGridTemplateColumn MappingName="ImageLink">
13+
<syncfusion:TreeGridTemplateColumn.CellTemplate>
14+
<DataTemplate>
15+
<Image Source="{Binding Path=ImageLink,
16+
Converter={StaticResource converter}}"/>
17+
</DataTemplate>
18+
</syncfusion:TreeGridTemplateColumn.CellTemplate>
19+
</syncfusion:TreeGridTemplateColumn>
20+
```
21+
22+
## c# code:
23+
24+
``` c#
25+
public class StringToImageConverter : IValueConverter
26+
{
27+
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
28+
{
29+
string imagename = value as string;
30+
return new BitmapImage(new Uri(string.Format(@"..\..\Images\{0}", imagename), UriKind.Relative));
31+
}
32+
33+
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
34+
{
35+
return null;
36+
}
37+
}
38+
```

0 commit comments

Comments
 (0)