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 6557163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:02:20+00:00 2026-05-25T13:02:20+00:00

I want to do this: https://github.com/rails/rails/commit/f50aeda2f73b47c47664e3651c638ba624418b8b See how, as your mouse cursor moves over

  • 0

I want to do this:

https://github.com/rails/rails/commit/f50aeda2f73b47c47664e3651c638ba624418b8b

See how, as your mouse cursor moves over the lines of source code, an image/button appears to the left of the table? That.

So I have a Grid, and RowDefinition has MouseEnter and MouseLeave events. Turns out these events are useless and can never fire (please correct me if I’m wrong here), because they require a Background property (even if it’s Transparent), and RowDefinition doesn’t have a Background property.

I can’t just hook MouseEnter on every element in every cell, because by the time I’ve moved my mouse the newly visible button will have already disappeared.

How can I get this working?

  • 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-25T13:02:21+00:00Added an answer on May 25, 2026 at 1:02 pm

    The RowDefinitions and ColumnDefinitions aren’t actually in the Visual Tree since they are FrameworkContentElements (rather than FrameworkElements) and that’s why they don’t raise any mouse events, they aren’t Visuals. They are just used by the Grid to position its childs.

    One approach that comes to mind is to use the Attached Events Mouse.MouseMove and Mouse.MouseLeave on the Grid to get notified when these events are raised for any child in the Grid or the Grid itself.

    <Grid Mouse.MouseMove="Grid_MouseMove"
          Mouse.MouseLeave="Grid_MouseLeave"
          Background="Transparent">
    

    In the Mouse.MouseMove event handler we can get the relative mouse position to the Grid and calculate which RowDefinition is currently being hoovered by the mouse and store that in an Attached Property, like MouseOverRowDefinition.

    private void Grid_MouseMove(object sender, MouseEventArgs e)
    {
        Grid grid = sender as Grid;
        Point mousePoint = e.GetPosition(grid);
        double heightSum = grid.RowDefinitions[0].ActualHeight;
        int activeRow = 0;
        for (; heightSum < mousePoint.Y; activeRow++)
        {
            heightSum += grid.RowDefinitions[activeRow].ActualHeight;
        }
        GridExtensions.SetMouseOverRowDefinition(grid, activeRow);
    }
    // No RowDefinition is beeing hoovered, set MouseOverRowDefinition to -1
    private void Grid_MouseLeave(object sender, MouseEventArgs e)
    {
        Grid grid = sender as Grid;
        GridExtensions.SetMouseOverRowDefinition(grid, -1);
    }
    

    Now we can query the Grid for the MouseOverRowDefinition so the rest is just a matter of comparing Grid.Row for the Image to MouseOverRowDefinition for the Grid to decide if it should be Visible or not.

    Uploaded a small sample app that does this here if you want to try it out:
    http://dl.dropbox.com/u/39657172/MouseOverGridRowDefinition.zip

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

Sidebar

Related Questions

I have made this gem: https://github.com/RLovelett/feedzirra-rails I want to be able to include it
i want to install this https://github.com/sferik/rails_admin so i pasting those 2 in the gemfile
I want to use Redis. So I followed this tutorial: https://github.com/sebleier/django-redis-cache First, I install
I want to use this gem in my api application https://github.com/seangeo/auth-hmac/ I have a
I am using the Thumb_Up gem for ruby on rails. https://github.com/brady8/thumbs_up I want users
I want to use the zsh-git-prompt, from this repo https://github.com/olivierverdier/zsh-git-prompt , I've been using
I am using this http://github.com/professionalnerd/simple-private-messages plugin in rails and I am on a user
For http://github.com/collectiveidea/delayed_job Let's say I just start a brand new Rails project and want
I'm using DynamicGuys doctrine2 integration into zend framework(https://github.com/dynamicguy/zf1doctrine2). It works, but if i want
I want to compile an open source iPhone app( https://github.com/newsyc/newsyc/ ) but since I

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.