diff --git a/README.md b/README.md index 4b45a16..d69cdb8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,36 @@ -# How to load images in a cell in wpf and uwp treegrid? +# How to load images in a cell in WPF / UWP TreeGrid? -## About the example +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). -This example illustrates how to load images in a cell in wpf and uwp treegrid +You can add the image to TreeGrid cell by using [TreeGridTemplateColumn](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridTemplateColumn.html). + +### XAML: +``` xml + + + + + + + +``` + +### C#: +``` 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](ShowImagesInCell.png) \ No newline at end of file diff --git a/ShowImagesInCell.png b/ShowImagesInCell.png new file mode 100644 index 0000000..a2f0c23 Binary files /dev/null and b/ShowImagesInCell.png differ