Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the border for a WPF DataGrid Row which is currently having the focus

I want to set the border for a DataGrid Row which is currently having the focus. But not the seleced row because when the Multi selection is enabled for the datagrid then there is a chance that multiple rows can be selected.

I need a solution in XAML

Thanks in advance!

like image 811
ksvimal Avatar asked Oct 23 '25 20:10

ksvimal


1 Answers

Add this to DataGridRow's style (either using Resources, or by setting DataGrid.RowStyle):

<Style TargetType="DataGridRow">
    <Style.Triggers>
        <Trigger Property="IsFocused" Value="true">
            <Setter Property="BorderBrush" Value="Red" />
            <Setter Property="BorderThickness" Value="1" />
        </Trigger>
    </Style.Triggers>
</Style>
like image 109
svick Avatar answered Oct 26 '25 15:10

svick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!