Hello!
We have a XamDatagrid that has set the "LabelClickAction" to "SelectField". Now we want to set the font weight of the label to be bold and maybe the background of the fields to be any color. How to do that?
Thanks, Florian
Florian,
Check out this style for the CellValuePresenter:
<Grid.Resources>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="BackgroundFieldSelected" Value="Red"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Field.IsSelected,
RelativeSource={RelativeSource Self}}"
Value="True">
<Setter Property="FontWeight" Value="Bold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Resources>
Hello Vlad,
thanks, this works for the background color and font weight of the cells. But how about the font weight of fields label?
The other issue I ran into now, is that I use ControlTemplate to show checkboxes. How can I change the background color of those cells?
<Style x:Key="CheckboxCvp" TargetType="{x:Type DataPresenter:CellValuePresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DataPresenter:CellValuePresenter}"> <CheckBox VerticalAlignment="Center" HorizontalAlignment="Center" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value, Mode=TwoWay}"/> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <DataTrigger Binding="{Binding Path=Field.IsSelected, RelativeSource={RelativeSource Self}}" Value="True"> <Setter Property="FontWeight" Value="Bold"/> </DataTrigger> </Style.Triggers></Style>