Using C#.Net 4.5, Visual Studio 2012 Ulti, WPF.
I\'ve got some old win-forms code that i wanted to do in this new WPF app.
code is the following:
<
Here is what I did. Add a datatemplate in your datagrid with image control like this
As you can see my I am binding Image with a property named "FileIcon" that is used in class Version like this
public class Version
{
public string FileIcon { get; set; }
}
Now only this you have to do is bind provide a path to "FileIcon" and update ItemSource of DataGrid like this
ObservableCollection items = new ObservableCollection();
items.Add(new Version()
{
FileIcon = "/AssemblyName;component/Images/eye.png",
});
YourDataGrid.ItemsSource = null;
YourDataGrid.ItemsSource = items;