I have a WPF DataGrid presented in XAML . I use RowStyle for my TableView grid, but it is also necessary to set some properties for specific cells. I need these cells to have row style properties and apply additional properties from the cell style on top of them.
I need something like this, although this does not work as it says:
The target type "CellContentPresenter" is not converted to the base type "GridRowContent"
<Style x:Key="MyGridRowStyle" BasedOn="{StaticResource {themes:GridRowThemeKey ResourceKey=RowStyle}}" TargetType="{x:Type dxg:GridRowContent}"> <Setter Property="Height" Value="25" /> <Style.Triggers> ... </Style.Triggers> </Style> <Style x:Key="MyCellStyle" BasedOn="{StaticResource MyGridRowStyle}" TargetType="{x:Type dxg:CellContentPresenter}"> <Style.Triggers> ... </Style.Triggers> </Style>
I also did not try to specify the BasedOn property for MyCellStyle , but this does not work either.
I use MyCellStyle as follows:
<dxg:GridColumn Header="My Header" FieldName="MyFieldName" Width="100" CellStyle="{StaticResource MyCellStyle}" />
and MyGridRowStyle , as shown in TableView :
RowStyle="{StaticResource MyGridRowStyle}"
How to make a cell style change the properties specified in MyCellStyle and use the values specified in MyGridRowStyle for other properties?
source share