Hello!
I want one of my columns to show a image and a TextEditor, the image should be able to change visability depending on valuechange in another column. I made a CellValuePresenterStyle to do this but the object i get is a DataRecord and I need to get to properties on the Cell.
Can someone help me with this please?
/Sara
<Style x:Key="CellStyle" TargetType="{x:Type igDP:CellValuePresenter}" BasedOn="{StaticResource SmallCellValueStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Image x:Name="Image" Source=" ../../../../Resources/Orgchart.png" Visibility="Hidden"/>
<Editors:XamTextEditor Text="{Binding Path=Quantity}" />
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Path=IsChildrenModified}" Value="True">
<Setter TargetName="Image" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
The associated Cell isn't currently exposed since the cells are lazily allocated but if this style is specific for a field then you can use the Record.Cells[fieldname] to get the cell.
Hi
Thanks for the answers but I'm afraid I still dont understand how I should do it.
This is my style, I'm trying to bind to the MyPropertyOnTheCellObject and MyOtherPropertyOnTheCellObject, but can´t find the cell object. How should I do the binding? Can I use the fieldname in the style?
<Style x:Key="CellStyle" TargetType="{x:Type igDP:CellValuePresenter}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image x:Name="Image" Grid.Column="0" Source=" ../../../../Resources/Orgchart.png" Visibility="Hidden"/>
<Editors:XamTextEditor Grid.Column="1" Text="{Binding Path=MyPropertyOnTheCellObject}" >
</Editors:XamTextEditor>
<DataTrigger Binding="{Binding Path=MyOtherPropertyOnTheCellObject}" Value="True">
Edit: removed a modified copy of the style that accedently got added