Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6618299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:48:50+00:00 2026-05-25T20:48:50+00:00

I have a wpf datagrid. I have added styling to show a mouseover color

  • 0

I have a wpf datagrid. I have added styling to show a mouseover color on a row.

What I am trying to achieve is when the mouseover appears, and a user starts using the arrow keys to navigate up and down, the mouseover needs to disappear and only the row that the user used arrow keys to get to, is the highlighted one.

The issue is the mouse cursor has been left on the grid while the user navigates with the arrow keys and the row under the cursor holds the highlight as well as the row the went to using arrows.

Here is my sample xmal:

<DataGrid AutoGenerateColumns="True" Height="277" HorizontalAlignment="Left" Margin="0,311,0,0" Name="dataGrid1" 
          VerticalAlignment="Top" 
          Width="478" ItemsSource="{Binding Path=Persons}" 
          RowHeight="20" 
          RowHeaderWidth="35" Grid.ColumnSpan="2" >
    <DataGrid.RowStyle>
        <Style TargetType="DataGridRow">
            <Style.Triggers>
                <Trigger Property="IsMouseOver"
                   Value="True">
                    <Setter Property="Background"
                       Value="Green" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </DataGrid.RowStyle>
</DataGrid>

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:48:51+00:00Added an answer on May 25, 2026 at 8:48 pm

    You’ll need to set some kind of flag when the user hits an Arrow key so that the background only changes if IsMouseOver and IsUsingArrowKeys is false. You might even be able to use the Mouse Visibility as a condition instead of using a flag

    I’m not positive the exact syntax, but it should be something like this

    <Style.Triggers>
        <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
                <!-- May need to reference RelativeSource here, not sure -->
                <Condition Property="IsMouseOver" Value="False" />
                <Condition Binding="{Binding IsUsingArrowKeys}" Value="False" />
            </MultiDataTrigger.Conditions>
            <Setter Property="Background" Value="Green" />
        </MultiDataTrigger>
    </Style.Triggers>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF Datagrid populated using a Dataset. I am trying to change
I am using a WPF DataGrid and I have the IsSelected property of the
I have wpf datagrid, in one of columns, I checkboxes added in it, now
I have a WPF DataGrid bound to some entities (Entity Framework 4+). User then
I want to achieve the following: Create a WPF DataGrid that have 2 columns:
I have a WPF Datagrid and I am populating the row numbers for it
I have a WPF DataGrid which has an AlternatingRowBackground brush. It's configured to color
I have a WPF DataGrid. When a user press the tab key i dont
I have a WPF DataGrid who's data source is an ObservableCollection. It is set
I have a WPF toolkit DataGrid as the dropdown in a ComboBox template. <toolkit:DataGrid

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.