public override void DropElement(System.Windows.FrameworkElement element, LayoutItemInsertionPoint insertionPoint, LayoutItemInsertionKind insertionKind) { MyLayoutGroup elemPar = element.Parent as MyLayoutGroup; bool IsSourceIsolated = false; if (elemPar != null) { IsSourceIsolated = elemPar.IsIsolatedGroup; } bool IsTargetIsolated = false; MyLayoutGroup targParent = insertionPoint.Element.Parent as MyLayoutGroup; if (targParent != null) { IsTargetIsolated = targParent.IsIsolatedGroup; } if (element.Parent != null) { if (element.Parent != insertionPoint.Element.Parent && (IsSourceIsolated || IsTargetIsolated)) { return; } } if (element.Parent == null && IsTargetIsolated) { return; } base.DropElement(element, insertionPoint, insertionKind); }
protected override FrameworkElement CreateNewItem(LayoutControlNewItemInfo itemInfo) { if (itemInfo.Data is MyNewItem) { MyLayoutGroup item = new MyLayoutGroup(); item.IsIsolatedGroup = true; item.Header = itemInfo.Label; item.View = LayoutGroupView.GroupBox; InitNewItem(item); return(item); } return(base.CreateNewItem(itemInfo)); }
protected override void OnInsertionInfoChanged() { MyLayoutGroup elemPar = OriginalParent as MyLayoutGroup; bool IsSourceIsolated = false; if (elemPar != null) { IsSourceIsolated = elemPar.IsIsolatedGroup; } bool IsTargetIsolated = false; MyLayoutGroup targParent; if (InsertionInfo.DestinationItem != null) { targParent = InsertionInfo.DestinationItem.Parent as MyLayoutGroup; if (targParent != null) { IsTargetIsolated = targParent.IsIsolatedGroup; } } if (OriginalParent != null && InsertionInfo.DestinationItem != null) { if (OriginalParent != InsertionInfo.DestinationItem.Parent && (IsSourceIsolated || IsTargetIsolated)) { NoIndicator(); return; } } if (OriginalParent == null && IsTargetIsolated) { NoIndicator(); return; } base.OnInsertionInfoChanged(); }