We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use image path as an image source in GridImageColumn?

Platform: WPF |
Control: SfDataGrid |
.NET Framework: 4.5 |
Product Version:
Tags: columns, binding

GridImageColumn helps you bind the types that are supported by Image.Source,
such as BitMapImage. When you bind a format other than the supported format, such as name of the image or file path of the image, GridImageColumn does not load the images. In such cases, you can use converter in ValueBinding for GridImageColumn that converts the string path to support Image source format. The following code example illustrates how to bind the image name or file path to GridImageColumn with the help of ValueBinding along with Converter to convert image name to BitMapImage.


            ItemsSource="{Binding OrderInfoCollection}" 
                MappingName="OrderID" HeaderText="Order ID"/>
            MappingName="CustomerID" HeaderText="Customer ID"/>
            MappingName="CustomerName" HeaderText="Name of Customer"/>
            MappingName="ShipCountry" HeaderText="Ship Country"/>
                MappingName="ShipCity" HeaderText="Ship City"/>
                MappingName="ImageLink" ImageHeight="50"
                ValueBinding="{Binding Path=ImageLink, 
                Converter={StaticResource stringToImageConverter}}" />

SfDataGrid bounded to collection of OrderInfo and OrderInfo class have a property ImageLink that contains the image names on the Project.

Gridimage column

Following is the converter that converts image name (placed in the Project) into BitMapImage.


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

In WinRT and UWP you can give file path directly in StringToImageConveter. Convert method code example for WinRT and UWP platform is as follows.

public object Convert(object value, Type targetType, object parameter, string language)


            if (value != null)


                string imagename = value as string;

                 return new Uri(string.Format(@"..\..\Image\{0}" ,

                  imagename), UriKind.Relative));           


            return null;


The following is the screenshot for image column that loads images in GridImage Column.

                                                                                                                image column


Sample Links:






2X faster development

The ultimate WPF UI toolkit to boost your development speed.
You must log in to leave a comment
Mar 15, 2016
I have uploaded new image in the same folder with the help of File.copy command. But new image that I have added is empty.Please tell me solution .I am waiting for your reply Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile