wpf: DataGrid disable selected row styles - or row selecting

Sonic Soul picture Sonic Soul · Jun 15, 2010 · Viewed 51.6k times · Source

I am seeing a lot of examples on how to style Selected rows in DataGrid such as this one:

How can I set the color of a selected row in DataGrid

Can i just disabled selected row styling? i don't want to have to override every single thing that selected row changes. Just don't want any visible changes. Gotta be easier way than to create templates..

or..

disable selecting rows, if that is easier.. but from browsing this forum that seems hacky as well

Disable selecting in WPF DataGrid

Answer

Sonic Soul picture Sonic Soul · Jun 18, 2010

figured out the XAML to get rid of selection style.. not ideal, but close enough..

<Style x:Key="CellStyle" TargetType="{x:Type DataGridCell}">
    <Setter Property="Foreground" Value="Black" />
    <Style.Triggers>
        <Trigger Property="IsSelected" Value="True">
            <Setter Property="Background" Value="{x:Null}" />
            <Setter Property="BorderBrush" Value="{x:Null}" />
        </Trigger>
    </Style.Triggers>
</Style>