Displaying Images in Datagrid in WPF C#
How to display images along with Data in a Datagrid in WPF
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Raaj KumarPosted Mar 8, 2010, 1:45 AM
Download latest WPFToolkitCheck and add reference to it. Then add few images to the project folder for displaying in datagrid. Now add the following XAML,
VerticalAlignment="Top"
ItemsSource="{Binding}"
AutoGenerateColumns="False">
and in code behind,
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
Loaded += new RoutedEventHandler(Window1_Loaded);
}
void Window1_Loaded(object sender, RoutedEventArgs e)
{
List
imageList.Add("Images/Sample1.jpg");
imageList.Add("Images/Sample2.jpg");
imageList.Add("Images/Sample3.jpg");
imageList.Add("Images/Sample4.jpg");
imageDataGrid.ItemsSource = imageList;
}
}
That's it.
Regards,
raaj