I have a problem displaying an image in WPF. The problem is that I add the image into the Grid and I can not actually see the image. I can see the place where the image is, but not the image itself (check the image below):
Here is my code:
View:
<DataGridTemplateColumn Header="Image" Width="SizeToCells" IsReadOnly="True" Visibility="Visible">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Height="25" Width="50" Source="{Binding Path=ImageArticle}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
Here I take the path and add it:
ContinueArticle ca = new ContinueArticle();
string ImagePath = Environment.CurrentDirectory + @"C:\iClipIT\Thumbs\" + ClipID;
ca.ImageArticle = ImagePath;
atlist.Add(ca);
And here I create the object and the getters and setters:
public static readonly DependencyProperty ArticleImageProperty
= DependencyProperty.Register("ArticleImage", typeof(string), typeof(ContinueArticle));
public string ImageArticle
{
get
{
return (string)GetValue(ArticleImageProperty);
}
set
{
SetValue(ArticleImageProperty, value);
}
}
Any clue what I'm doing wrong? I read a lot about this and I can't find the problem.