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

  • Home
  • SEARCH
  • 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 5955347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:06:05+00:00 2026-05-22T18:06:05+00:00

First off, the title may not be a good one. I’m using WPF 4

  • 0

First off, the title may not be a good one.

I’m using WPF 4 DataGrid a lot. One feature I’d like to have is to highlight the mouse over row. My first attempt is to change the background color using a Trigger on DataGridRow. However, there is a conflict with the read-only datagrid cells, see my other post here. Now, the next best thing I can do is to add a border to the mouse over row. This can easily be done with this style:

<Style TargetType="DataGridRow">
    <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="Red"/>
        </Trigger>
    </Style.Triggers>
</Style>

The problem is that some of the DataGrid have star sized columns, and it doesn’t normally show horizontal scrollbar. However, with this style Trigger, because it’s adding one unit border, the scrollbar becomes visible when mouse is over the grid. I thought it could be resolved if I could make the star column a little bit smaller. Is it possible? Or do you have any other idea?

EDIT: Even if I change the value for border thickness to “1 1 0 1” (so to make it borderless at right), the scrollbar still shows up.

  • 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-22T18:06:05+00:00Added an answer on May 22, 2026 at 6:06 pm

    You may try reducing the DataGridRow’s margins.

    <Style TargetType="DataGridRow">
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="BorderBrush" Value="Red"/>
                <Setter Property="Margin" Value="0,0,-2,0"/>
            </Trigger>
        </Style.Triggers>
    </Style>
    

    Two caveats for the value I gave: The right-side border line does not appear, no matter what you set the margin to, although that may be true even without the margin setter. And when the trigger activates for your “last” or “bottom” row, the column headers shift (in this case, they all shift to the right a bit).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, I'd like to apologise for the ludicrous title. I'm not trying to
First off - apologies for the poor title, I have no idea how to
First off, I am using Windows XP. I have multiple hard drives and it
First off, I'm not entirely sure that my question title is very descriptive, so
First off I'm not sure that's the proper title for this question but hopefully
First off, I apologize if I'm not using the right terms in my question
First off, I'd like to apologize for the horrid title there, but it was
First time using CSS so my question may not make sense. I am using
First off: I'm using a rather obscure implementation of javascript embedded as a scripting
First off, let me start off that I am not a .net developer. The

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.