This is a migrated thread and some comments may be shown as answers.

Expand hierarchy on mouse enter

2 Answers 84 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 15 Aug 2014, 08:30 PM
I'm looking for a way to define a mouse enter event for the expand button on a hierarchy gridview. I have nested grids and a drag and drop functionality. I want to be able to start dragging and then mouse over the + and expand another row to drop into the child gridview. Is this a possibility?

2 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 18 Aug 2014, 04:20 PM
I think I'm basically trying to do the treeview DropExpandDelay in a gridview.
0
Yoan
Telerik team
answered on 19 Aug 2014, 11:43 AM
Hi Mark,

If you want to expand the row when the mouse is over the + button, then you can use GridView's PreviewMouseMove event. Then you can find the underling element, verify it is GridViewToggleButton and expand the row details. Please check the following code snippet for a reference:
private void clubsGrid_PreviewMouseMove(object sender, MouseEventArgs e)
      {
          var element = e.OriginalSource as FrameworkElement;
 
          var toggleButton = element.ParentOfType<GridViewToggleButton>();
 
          if (toggleButton != null)
          {
              var row = toggleButton.ParentOfType<GridViewRow>();
 
              if (row != null)
              {
                  row.DetailsVisibility = Visibility.Visible;
              }
          }
      }

I hope tihs helps.

Regards,
Yoan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or