Skip to content
Discussion options

You must be logged in to vote

Use this:

<DataGrid.Styles>
    <Style Selector="DataGridRow:selected /template/ DataGridCellsPresenter">
        <Setter Property="Background" Value="Red"></Setter>
    </Style>
</DataGrid.Styles>

Because all styles have lower priority than local property assignment in xaml, while pseudo class is a event-like status that should be evaluated on runtime
That's why we need a dedicated syntax /template/ to target the nested presenter type
we just need a way to let the styling system know it's something different so that it can manage the priority separately.

See discussions:

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by s899000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants