Posted 20 May 2020, 9:26 pm EST - Updated 3 October 2022, 11:54 pm EST
Prevent DockTabControl Floating outside parent control
Posted by: vinothkumar.r2210 on 20 May 2020, 9:26 pm EST
-
-
Posted 22 May 2020, 7:10 am EST
Hi Vinoth,
I would suggest you to try using C1DragDropManager and handle its DragLeave event. Below is sample code snippet for same.```
C1DragDropManager dd = new C1DragDropManager();
foreach (UIElement e in _docktab1.Items)
{
dd.RegisterDragSource(e, DragDropEffect.Move, ModifierKeys.None);
}
foreach (UIElement e in dockControl.Items)
{
dd.RegisterDropTarget(e, true);
}
dd.RegisterDragSource(_docktab1, DragDropEffect.Move, ModifierKeys.None);
dd.DragLeave += Dd_DragLeave;
private void Dd_DragLeave(object source, DragDropEventArgs e)
{
var dragSource = e.DragSource as C1.WPF.Docking.C1DockTabControl;
if(dragSource!=null)
{
var parent = dragSource.Parent as C1.WPF.Docking.C1DockControl;
if (parent!=null)
{
if(parent.IsMouseCaptureWithin ==false && parent.IsMouseDirectlyOver == false )
{
e.Effect = DragDropEffect.None;
}
}
}
}Ruchir