Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1915
Ability to display bound Text and Image in the same cell in XamDataGrid
posted

Searched the forums but did not find a clear solution. I need a way to have an image and cell text to be displayed at the same time. I am able to display either in two separate columns. I have attempted to modify default CellValuePresenter style but its unclear how precisely the binding should be set. Assume I have the following structure in XAML:

<igDP:XamDataGrid>

<igDP:XamDataGrid.Resources>
<Style x:Key="imageStyle" TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igDP:XamDataGrid.Resources>

<igDP:Field Name="Status">
<igDP:Field.Settings>
<igDP:FieldSettings FilterLabelIconDropDownType="MultiSelectExcelStyle"/>
</igDP:Field.Settings>
</igDP:Field>

<igDP:Field Name="StatusImageURI" Label="Status">
<igDP:Field.Settings>
<igDP:FieldSettings CellValuePresenterStyle="{StaticResource imageStyle}"/>
</igDP:Field.Settings>
</igDP:Field>

So columns for Status and StatusImageURI contain the text and the Image to be displayed. I suppose another way to do this would be to merge these two columns. Any solution is acceptable. Thanks.