Hi
how can I show an image in a grid cell via Uri ?
I've a uri which points to an image in the application. The Grid has a ObservableCollection<myEntity> as DataSource.
If I set the column of the grid to the uri I see the plain text. Setting the DataType of the Cell to System.Windows.Controls.Image and don't see anymore any column at runtime (I think this indicates a configuration mistake?)
When I change binding to a property of an System.Windows.Image instance everything works fine.
But does would mean that I have to instantiate all images manually and dispose them somewhen later.What would be the best place to dispose these images?
How do I have to define the column so that the uri is shown ?
Hello,
I am just checking have you been able to resolve your issue? If you still need any assistance on the matter do not hesitate to ask.
In case the above suggestion helped you solve your issue please verify the thread as answered, so other users may take better advantage of it.
When you set uri as a content of the XamDataGrid by default it is edited like text so you can’t see the image. My advice is to add an Image control as content of the CellValuePresenter for this column and bind its source to the content of the cell. I can suggest you the following approach:
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="imageStyle" >
<Setter Property="Content">
<Setter.Value>
<Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}"/>
</Setter.Value>
</Setter>
</Style>
If you need any further assistance on the matter please let me know.