I want to Show an Image in one field of XamDataGrid. the path of the Image i have as Property in my Model Object. i was able to Show the Image using normal WPF DataGrid, but facing issues with XamDataGrid.( see in point 2)
1. Binding ItemImage Property to XamDataGrid Field.
<igDP:Field Name="ItemImage" Label="Device Image"> <igDP:Field.Settings> <igDP:FieldSettings AllowEdit="False"> <igDP:FieldSettings.CellValuePresenterStyle> <Style TargetType="{x:Type igDP:CellValuePresenter}" > <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <Grid> <Image Source="{Binding RelativeSource={RelativeSource AncestorType={x:Type igDP:XamDataGrid}}, Path=ItemImage, Converter={StaticResource ImageConverter}}"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </igDP:FieldSettings.CellValuePresenterStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
3. Working with normal WPF Data Grid.
<DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Image Source="{Binding ItemImage, Converter={StaticResource ImageConverter}}" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn>
please let me know. if i have to make any change in Step 2.
Hello Kamlendra,
I believe that Maria has already created a sample project for you with the functionality you want. I attached it here, too, so other community members may benefit from it as well.
Hope this helps you.
hi Stefan,
i have already tried whatever you are suggesting.
1st solution.<Style TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Content"> <Setter.Value> <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}"/></Setter.Value></Setter></Style>
2nd way.
<
Setter Property="Template"
>
<Setter.Value
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"
<Image Source="{Binding Path=DataItem.ItemImage, Converter={StaticResource ImageConverter}}"
/>
</ControlTemplate
</Setter.Value
but both of them are not working.As i was looking for quick answer . i have also posted this as support request https://es.infragistics.com/my-account/support-case/CAS-124605-V6J9N5 please delete one of them. and i ahve tried both solution.no luck.
Thank you for your post. I have been looking into it and I can suggest you see this forum thread:
http://es.infragistics.com/community/forums/t/57441.aspx
where a similar issue is already discussed. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.