Hi,
I have Two UltraGrids . I'm doing a DragAndDrop of rows from the first to the second Grid..
The Drag operation start from the Grid1 to the Grid2
I want to change the Appearance of the Row when the mouse cursor on it and changed back whent leave.
I'm using the DragOver event to changed like this ::
ultraGrid2.DragOver += (s, e) => {
Point point = ultraGrid2.PointToClient(new Point(e.X, e.Y)); UIElement element = ultraGrid2.DisplayLayout.UIElement.ElementFromPoint(point); if (element != null) { UltraGridRow row = element.GetContext(typeof(UltraGridRow)) as UltraGridRow; if (row != null) { row.Appearance.BackColor = Color.Goldenrod; lastPoint = point; } } };
and the DragLeave to changed back to Original Appearance
ultraGrid2.DragLeave += (s, e) => {Point point = ultraGrid2.PointToClient(new Point(e.X, e.Y)); UIElement element = ultraGrid2.DisplayLayout.UIElement.ElementFromPoint(point ); if (element != null) { UltraGridRow row = element.GetContext(typeof(UltraGridRow)) as UltraGridRow; if (row != null) { row.Appearance.ResetBackColor(); } } } Console.WriteLine("Drag LEAVE"); };
Can you tell me the right way to get this working ..
thx
Hi Michel,
Since there can only be one 'drop' row at a time and you will want to keep track of that row, anyway for when the drop occurs, it would be convenient to store the drop row in a property. That way you can highlight the row (apply an appearance) based on that property and this would make it easy to clear the previously-highlighted row.
I have attached a sample here that does that.
WindowsFormsApp5.zip
Thank you.
Can you post an example?
I can't make it working.
Thx
Hello Michel,
Thank you for contacting Infragistics!
In your drag leave even you are using the getting the point the mouse is at, however since this is the leave event this will no longer be the row you were hovering over. If you want to revert the style you will have to store the row/rows you have in the drag over events to be used later in the drag leave.