private void OnPreviewShowCompass(object sender, PreviewShowCompassEventArgs e) { bool isRootCompass = e.Compass is RootCompass; var splitContainer = e.DraggedElement as RadSplitContainer; if (splitContainer != null) { bool isDraggingDocument = splitContainer.EnumeratePanes().Any(p => p is RadDocumentPane); var isTargetDocument = e.TargetGroup == null ? true : e.TargetGroup.EnumeratePanes().Any(p => p is RadDocumentPane); if (isDraggingDocument) { e.Canceled = isRootCompass || !isTargetDocument; } else { e.Canceled = !isRootCompass && isTargetDocument; } } }
private void OnPreviewShowCompass(object sender, PreviewShowCompassEventArgs e) { var isRootCompass = e.Compass is RootCompass; var splitContainer = e.DraggedElement as RadSplitContainer; if (splitContainer != null) { var isDraggingDocument = splitContainer.EnumeratePanes().Any(p => p is RadDocumentPane); var isTargetDocument = e.TargetGroup == null || e.TargetGroup.EnumeratePanes().Any(p => p is RadDocumentPane); if (isDraggingDocument) { e.Canceled = isRootCompass || !isTargetDocument; } else { e.Canceled = !isRootCompass && isTargetDocument; } } }
private void RadDocking_PreviewShowCompass(object sender, PreviewShowCompassEventArgs e) { if (e.TargetGroup != null) { e.Compass.IsCenterIndicatorVisible = CanDockIn((RadSplitContainer)e.DraggedElement, e.TargetGroup, DockPosition.Center); e.Compass.IsLeftIndicatorVisible = CanDockIn((RadSplitContainer)e.DraggedElement, e.TargetGroup, DockPosition.Left); e.Compass.IsTopIndicatorVisible = CanDockIn((RadSplitContainer)e.DraggedElement, e.TargetGroup, DockPosition.Top); e.Compass.IsRightIndicatorVisible = CanDockIn((RadSplitContainer)e.DraggedElement, e.TargetGroup, DockPosition.Right); e.Compass.IsBottomIndicatorVisible = CanDockIn((RadSplitContainer)e.DraggedElement, e.TargetGroup, DockPosition.Bottom); } else { e.Compass.IsLeftIndicatorVisible = CanDock((RadSplitContainer)e.DraggedElement, DockPosition.Left); e.Compass.IsTopIndicatorVisible = CanDock((RadSplitContainer)e.DraggedElement, DockPosition.Top); e.Compass.IsRightIndicatorVisible = CanDock((RadSplitContainer)e.DraggedElement, DockPosition.Right); e.Compass.IsBottomIndicatorVisible = CanDock((RadSplitContainer)e.DraggedElement, DockPosition.Bottom); } e.Canceled = !(CompassNeedsToShow(e.Compass)); }
private void DockCompassPreview(object sender, PreviewShowCompassEventArgs e) { if (e.TargetGroup != null && e.TargetGroup.Name == "Sidebar") { e.Compass.IsLeftIndicatorVisible = false; e.Compass.IsTopIndicatorVisible = false; e.Compass.IsRightIndicatorVisible = false; e.Compass.IsBottomIndicatorVisible = false; e.Compass.IsCenterIndicatorVisible = false; } else { e.Compass.IsLeftIndicatorVisible = false; e.Compass.IsTopIndicatorVisible = false; e.Compass.IsRightIndicatorVisible = false; e.Compass.IsBottomIndicatorVisible = false; e.Compass.IsCenterIndicatorVisible = true; } }