WPF databind in memory image to Image control
- by Ready Cent
I am using a DataGrid and trying to do the following Databinding
<DataTemplate>
<Grid>
<Image>
<Image.Source>
<BitmapImage UriSource="{Binding Data.CustomImage}" CacheOption="OnLoad" />
</Image.Source>
</Image>
</Grid>
</DataTemplate>
CustomImage is of type BitmapImage. When I run I get the error:
Initialization of 'System.Windows.Media.Imaging.BitmapImage' threw an exception.
The thing is that these images are stored as resources in a different assembly so I can't just point to a location on disk