internal static void Attach(RadRadialMenu menu) { if (popup == null) { #if NETFX_CORE popup = new Popup(); #else //TODO UNO popup = new Windows.UI.Xaml.Controls.Popup(); #endif overlay = new Canvas() { Width = Window.Current.Bounds.Width, Height = Window.Current.Bounds.Height }; popup.Child = overlay; } if (PopupService.CurrentAttachedMenu != null) { Detach(); } PopupService.CurrentAttachedMenu = menu; overlay.Children.Add(menu); popup.IsOpen = true; }
public RadialMenuModel(RadRadialMenu owner) { this.layout = new FixedSegmentLayout(owner.startAngleCache); this.viewState = new MenuViewState(); this.MenuItems = new MenuItemCollection <RadialMenuItem>() { Owner = this }; this.owner = owner; this.actionService = new ActionService(); this.contentRing = new RingModel(this.layout, new MenuItemLayer()); this.decorationItemsRing = new RingModel(this.layout, new ItemVisualStateLayer()) { HitTestVisible = false }; this.backgroundSectorItemsRing = new RingModel(this.layout, new BackgroundSectorItemLayer()) { HitTestVisible = false }; this.navigateRing = new NavidateItemRingModel(this.layout); this.UpdateStartAngle(owner.startAngleCache); }
protected override Windows.Foundation.Point GetMenuPosition(RadRadialMenu menu) { //get the left top point of the target element var targetPosition = this.Owner.TransformToVisual(null).TransformPoint(new Point(this.Owner.ActualWidth, 0)); //calulate the desired menu position var position = new Point(targetPosition.X - menu.ActualWidth + this.Owner.ActualWidth / 2, targetPosition.Y + this.Owner.ActualHeight / 2 - menu.ActualHeight / 2); return position; }
protected override Windows.Foundation.Point GetMenuPosition(RadRadialMenu menu) { //get the left top point of the target element var targetPosition = this.Owner.TransformToVisual(null).TransformPoint(new Point(this.Owner.ActualWidth, 0)); //calulate the desired menu position var position = new Point(targetPosition.X - menu.ActualWidth + this.Owner.ActualWidth / 2, targetPosition.Y + this.Owner.ActualHeight / 2 - menu.ActualHeight / 2); return(position); }
public void ShowDataViewItemMenus(MyDataObject dataObject, List <DataReportMenu> menus) { RadRadialMenu menu = new RadRadialMenu(); //menu.ShowEventName = "MouseEnter"; //menu.HideEventName = "MouseLeave"; foreach (var item in menus) { AddMenu(menu.Items, item); } menu.PopupPlacement = System.Windows.Controls.Primitives.PlacementMode.Center; //(dataViewItem as UC_DataViewItem).SetMenu(menu); RadRadialMenu.SetRadialContextMenu(this, menu); RadialMenuCommands.Show.Execute(null, this); menu.PopupPlacement = System.Windows.Controls.Primitives.PlacementMode.Center; menu.IsOpen = true; menu.PopupPlacement = System.Windows.Controls.Primitives.PlacementMode.Center; //menu.PopupHorizontalOffset = 115; //menu.PopupVerticalOffset = 5; }
internal static void Attach(RadRadialMenu menu) { if (popup == null) { popup = new Popup(); overlay = new Canvas() { Width = Window.Current.Bounds.Width, Height = Window.Current.Bounds.Height }; popup.Child = overlay; } if (PopupService.CurrentAttachedMenu != null) { Detach(); } PopupService.CurrentAttachedMenu = menu; overlay.Children.Add(menu); popup.IsOpen = true; }
internal static void Detach() { if (popup != null) { popup.IsOpen = false; } if (PopupService.CurrentAttachedMenu != null) { if (PopupService.CurrentAttachedMenu.TargetElement != null) { var behavior = RadRadialContextMenu.GetBehavior(PopupService.CurrentAttachedMenu.TargetElement); if (behavior != null) { behavior.DetachFromTargetElement(); } } overlay.Children.Remove(PopupService.CurrentAttachedMenu); PopupService.CurrentAttachedMenu = null; } }
//////public void ClearValidationMessage(UIControlPackage uIControlPackage) //////{ ////// if (uIControlPackage.RelatedUIControls != null) ////// { ////// if (uIControlPackage.RelatedUIControls.Count > 0) ////// { ////// var label = uIControlPackage.RelatedUIControls.FirstOrDefault(x => x.RelationType == AG_ControlRelationType.Label); ////// if (label != null) ////// { ////// LabelHelper.DeHighlight(label.RelatedUIControl); ////// } ////// } ////// } //////} //public string GetGroupControlKey(string mainName, string itemName) //{ // return TabHelper.GetTabKey(mainName, itemName); //} public void ShowDataViewItemMenus(List <DataMenuUI> menus, string title, object sourceObject) { if (menus.Any()) { RadRadialMenu menu = new RadRadialMenu(); foreach (var item in menus) { AddMenu(menu.Items, item); } if (!string.IsNullOrEmpty(title)) { ToolTipService.SetToolTip(menu, title); } menu.HideEventName = "LostFocus"; menu.PopupPlacement = System.Windows.Controls.Primitives.PlacementMode.Center; RadRadialMenu.SetRadialContextMenu(sourceObject as UIElement, menu); RadialMenuCommands.Show.Execute(null, sourceObject as UIElement); menu.PopupPlacement = System.Windows.Controls.Primitives.PlacementMode.Center; menu.IsOpen = true; menu.PopupPlacement = System.Windows.Controls.Primitives.PlacementMode.Center; } }
/// <summary> /// Initializes a new instance of the <see cref="RadialMenuItemControlAutomationPeer"/> class. /// Automation Peer for the <see cref="Telerik.UI.Xaml.Controls.Primitives.Menu.RadialMenuItemControl"/> class. /// </summary> /// <param name="owner">The object that is associated with this AutomationPeer.</param> public RadialMenuItemControlAutomationPeer(RadialMenuItemControl owner, RadRadialMenu parent) : base(owner) { this.parent = parent; }
/// <summary> /// Initializes a new instance of the <see cref="RadRadialMenuAutomationPeer"/> class. /// Automation Peer for the <see cref="Telerik.UI.Xaml.Controls.Primitives.RadRadialMenu" /> class. /// </summary> /// <param name="owner">The object that is associated with this AutomationPeer.</param> public RadRadialMenuAutomationPeer(RadRadialMenu owner) : base(owner) { }
private void UpdateItemsSelectedStates(RadRadialMenu radialMenu) { StyleUIHelper helper = new StyleUIHelper(this.Editor); var boldRadialMenuItem = radialMenu.Items.FirstOrDefault(i => i.Header.ToString() == "Bold"); if (boldRadialMenuItem != null) { FontWeight? fontWeight = helper.GetFontWeightOfSpanStyle(); var isBold = fontWeight.HasValue && fontWeight.Value == FontWeights.Bold; boldRadialMenuItem.IsSelected = isBold; } var textAlignmentRadialMenuItem = radialMenu.Items.FirstOrDefault(i => i.Header.ToString() == "Alignment"); if (textAlignmentRadialMenuItem != null) { RadTextAlignment? textAlignment = helper.GetTextAlignmentOfParagraphStyle(); foreach (var item in textAlignmentRadialMenuItem.ChildItems) { if (item.Header.ToString() == textAlignment.ToString()) { item.IsSelected = true; } else { item.IsSelected = false; } } } }
internal static void PositionMenu(RadRadialMenu menu, Point positionPoint) { Canvas.SetLeft(menu, positionPoint.X); Canvas.SetTop(menu, positionPoint.Y); }
public HitTestService(RadRadialMenu owner) { this.registeredAreas = new WeakReferenceList <IHitTestArea>(); this.owner = owner; }
public VisualStateService(RadRadialMenu owner) { this.owner = owner; this.hoverVisual = new DecorationItemButton(); }