Skip to content

Commit 1caa2fe

Browse files
authored
Merge pull request #1 from SyncfusionExamples/ES-975464
ES-975464 - Resolve the ReadMe file length issue in this sample repository
2 parents bdd6c08 + 1e40d0f commit 1caa2fe

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
1-
# How to load images in a cell in wpf and uwp treegrid?
1+
# How to load images in a cell in WPF / UWP TreeGrid?
22

3-
## About the example
3+
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) (SfTreeGrid).
44

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

ShowImagesInCell.png

151 KB
Loading

0 commit comments

Comments
 (0)