I am trying to display an image in my datagrid in a template column, the code:
<data:DataGridTemplateColumn Header="" x:Name="colPriority">
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border BorderBrush="Black" Background="{Binding TimeMarker.TimeMarkerBrush}" BorderThickness="1" Width="38" ToolTipService.ToolTip="{Binding Path=TimeMarker.TimeMarkerName, StringFormat='Priority: {0}'}">
<Image
Source="{Binding ImageFlag}"
ToolTipService.ToolTip="{Binding TaskFlagStatus}"
Height="32"
Width="32"
Margin="3"/>
</Border>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
'ImageFlag' is a property of type 'image' in my object. The problem is that it is not showing up. When I change the source in the xaml to the relative URI of an image it shows up fine, but it won't show the image that is stored in the 'ImageFlag' property of my object. Why?
The object type you should be exposing in your model should be one that derives from
ImageSourcesuch asBitmapImage.The
Imageclass is the element that displays anImageSource, you can't assign an instance ofImageto theSourceproperty of anotherImage.