void RebuildDropTargetWindow(ActivatableTabControl targetControl) { if (this.dropTarget == null) { this.dropTarget = new TabDropTargetWindow() { AllowsTransparency = true, // It would be nice to be able to set these in the style... WindowStyle = WindowStyle.None, }; } bool controlDown = Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl); if (targetControl != null && !controlDown) { TabNode node = targetControl.TabNode; if (!this.dropTarget.IsVisible || this.dropTarget.TargetNode != node) { this.dropTarget.Hide(); this.dropTarget.UpdateLayout(); var pos = new Point(0, 0); pos = targetControl.PointToScreenIndependent(pos); this.dropTarget.Left = pos.X; this.dropTarget.Top = pos.Y; this.dropTarget.Width = targetControl.ActualWidth; this.dropTarget.Height = targetControl.ActualHeight; var parent = node.Parent; var grandparent = parent == null ? null : parent.Parent; this.dropTarget.VerticalParentNode = parent; this.dropTarget.HorizontalParentNode = parent; if (grandparent != null && parent.Slot.Orientation == Orientation.Vertical) { this.dropTarget.VerticalParentNode = grandparent; } else if (grandparent != null && parent.Slot.Orientation == Orientation.Horizontal) { this.dropTarget.HorizontalParentNode = grandparent; } this.dropTarget.TargetNode = node; this.dropTarget.IsTabbedSpotVisible = true; this.dropTarget.AreDockSpotsVisible = (targetControl != this.sourceControl || this.sourceControl.Items.Count > 1); this.dropTarget.Show(); this.dropTarget.UpdateLayout(); } } else { this.dropTarget.Hide(); } }
static void OnParentNodeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { TabDropTargetWindow target = obj as TabDropTargetWindow; if (target != null) { target.IsHorizontalParentVisible = target.HorizontalParentNode != null; target.IsVerticalParentVisible = target.VerticalParentNode != null; } }
void RebuildDropTargetWindow(ActivatableTabControl targetControl) { if (this.dropTarget == null) { this.dropTarget = new TabDropTargetWindow() { AllowsTransparency = true, // It would be nice to be able to set these in the style... WindowStyle = WindowStyle.None, }; } bool controlDown = Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl); if (targetControl != null && !controlDown) { TabNode node = targetControl.TabNode; if (!this.dropTarget.IsVisible || this.dropTarget.TargetNode != node) { this.dropTarget.Hide(); this.dropTarget.UpdateLayout(); var pos = new Point(0, 0); pos = targetControl.PointToScreenIndependent(pos); this.dropTarget.Left = pos.X; this.dropTarget.Top = pos.Y; this.dropTarget.Width = targetControl.ActualWidth; this.dropTarget.Height = targetControl.ActualHeight; var parent = node.Parent; var grandparent = parent == null ? null : parent.Parent; this.dropTarget.VerticalParentNode = parent; this.dropTarget.HorizontalParentNode = parent; if (grandparent != null && parent.Slot.Orientation == Orientation.Vertical) { this.dropTarget.VerticalParentNode = grandparent; } else if (grandparent != null && parent.Slot.Orientation == Orientation.Horizontal) { this.dropTarget.HorizontalParentNode = grandparent; } this.dropTarget.TargetNode = node; this.dropTarget.IsTabbedSpotVisible = true; this.dropTarget.AreDockSpotsVisible = (targetControl != this.sourceControl || this.sourceControl.Items.Count > 1); this.dropTarget.Show(); this.dropTarget.UpdateLayout(); } } else { this.dropTarget.Hide(); } }