/// <summary> /// It is used to position the <see cref="RadRadialMenu"/> and initiate menu position logic. /// </summary> protected internal virtual void AttachToTargetElement() { if (this.Owner == null) { return; } var menu = RadRadialContextMenu.GetMenu(this.Owner); if (menu != null && (PopupService.CurrentAttachedMenu != menu || (PopupService.CurrentAttachedMenu != null && PopupService.CurrentAttachedMenu.TargetElement != this.Owner))) { menu.model.actionService.PushAction( new DelegateAction(() => { if (menu.TargetElement != null) { var behavior = RadRadialContextMenu.GetBehavior(menu.TargetElement); if (behavior != null) { behavior.DetachFromTargetElement(); } else { this.DetachFromTargetElement(); } } menu.TargetElement = this.Owner; PopupService.Attach(menu); if (menu.DesiredSize.Height == 0 || menu.DesiredSize.Width == 0) { menu.LayoutUpdated += this.Owner_LayoutUpdated; } else { this.PositionMenu(menu); } })); } }