Hi,
I have styled my XamTreeGrid but have problems setting the BackgroundHover on ActiveItem. It works fine for unselected and selected rows but my active item always has the same background. I want my ListItemHoverBrush also on my ActiveItem. Here is my style:
<Style TargetType="{x:Type ig:DataRecordCellArea }" BasedOn="{StaticResource {x:Type ig:DataRecordCellArea}}"> <Setter Property="BackgroundSelected" Value="{DynamicResource ListItemSelectedBrush}" /> <Setter Property="BackgroundActive" Value="{DynamicResource ListItemSelectedBrush}" /> <Setter Property="BackgroundHover" Value="{DynamicResource ListItemHoverBrush}" /> <Setter Property="BorderActiveBrush" Value="Transparent" /> <Setter Property="BorderHoverBrush" Value="Transparent" /> <Setter Property="BorderSelectedBrush" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsSelected}" Value="False"> <Setter Property="BackgroundActive" Value="Transparent" /> <Setter Property="BorderActiveBrush" Value="Transparent" /> </DataTrigger> <DataTrigger Binding="{Binding Path=IsSelected}" Value="True"> <Setter Property="BackgroundHover" Value="{DynamicResource ListItemHoverBrush}" /> </DataTrigger>
</Style.Triggers> </Style>
I have tried to add the following but it does not change anything:
<DataTrigger Binding="{Binding Path=IsActive}" Value="True"> <Setter Property="BackgroundHover" Value="{DynamicResource ListItemHoverBrush}" /> </DataTrigger>
Hello Hilma,
I have been investigating into the behavior you are looking to achieve, and at the moment, the BackgroundActive takes precedent over BackgroundHover, which takes precedent over the BackgroundSelected.
If you are looking to have the hover brush take precedent over the active brush, I would recommend using the following style as a template:
<Style TargetType="{x:Type ig:DataRecordCellArea}"> <Setter Property="BackgroundActive" Value="Red" /> <Setter Property="BackgroundSelected" Value="Yellow" /> <Setter Property="BackgroundHover" Value="Blue" /> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding IsActive}" Value="True" /> <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}" Value="True" /> </MultiDataTrigger.Conditions> <Setter Property="BackgroundActive" Value="Blue" /> </MultiDataTrigger> </Style.Triggers> </Style>
Please let me know if you have any other questions or concerns on this matter.