Hi,
Can you tell me, How to get the EndDrag position of toolbar in
ToolBarModified event?
Or
Is there another way to get EndDrag position of ToolBar, when user started to drag toolbar?
How to get end drag position of toolbar when DockedPosition (always) = Floating?
Hi Kim
As I investigated, ToolbarChangeType.EndDrag also get float position of FloatToolbar before draged like ToolbarChangeType.StartDrag .
Actually, the code should look more like:
private void ultraToolbarsManager1_ToolbarModified(object sender, ToolbarModifiedEventArgs e) { if (e.ToolbarChangeType == ToolbarChangeType.EndDrag) { Point p; int x = 0; int y = 0;
if (e.Toolbar.DockedPosition == DockedPosition.Right || e.Toolbar.DockedPosition == DockedPosition.Left) { x = e.Toolbar.UIElement.Parent.Control.Location.X; y = e.Toolbar.UIElement.Rect.Y; p = new Point(x, y); } else if (e.Toolbar.DockedPosition == DockedPosition.Bottom || e.Toolbar.DockedPosition == DockedPosition.Top) { y = e.Toolbar.UIElement.Parent.Control.Location.Y; x = e.Toolbar.UIElement.Rect.X; p = new Point(x, y); } else p = e.Toolbar.FloatingLocation; } }
The reason being that the code I pasted before did not take into account the possibility of docking the toolbar to the right or bottom, which would make the x or y different.
~Kim~
amit_mundra_83,
Try handling the ToolbarModified event and use code like:
private void ultraToolbarsManager1_ToolbarModified(object sender, ToolbarModifiedEventArgs e) { if (e.ToolbarChangeType == ToolbarChangeType.EndDrag) { Point p; if (e.Toolbar.DockedPosition != DockedPosition.Floating) p = new Point(e.Toolbar.UIElement.Rect.X, e.Toolbar.UIElement.Rect.Y); else p = e.Toolbar.FloatingLocation; } }
This should give you the location of the top left corner of the UltraToolbar, whether it is docked or floating.
Hope this helps,