Beispiel #1
0
        internal async Task Show(string x, string y, string targetId = null, ContextMenuTrigger trigger = null)
        {
            if (trigger is null)
            {
                var rootMenu = menuTreeTraverser.GetRootContextMenu(this);
                trigger = rootMenu?.GetTrigger();
            }

            if (trigger != null)
            {
                Data = trigger.Data;
            }

            if (OnAppearing.HasDelegate)
            {
                var eventArgs = new MenuAppearingEventArgs(Id, targetId, x, y, trigger, Data);
                await OnAppearing.InvokeAsync(eventArgs);

                x = eventArgs.X;
                y = eventArgs.Y;
                if (eventArgs.PreventShow)
                {
                    return;
                }
            }

            IsShowing = true;
            X         = x;
            Y         = y;
            TargetId  = targetId;
            Trigger   = trigger;
            await InvokeAsync(() => StateHasChanged());
        }
Beispiel #2
0
 public MenuRenderingContext(string contextMenuId, string contextMenuTargetId, string x, string y, ContextMenuTrigger trigger, object data)
 {
     ContextMenuId       = contextMenuId;
     ContextMenuTargetId = contextMenuTargetId;
     ContextMenuTrigger  = trigger;
     Data = data;
     X    = x;
     Y    = y;
 }
Beispiel #3
0
 public MenuAppearingEventArgs(string contextMenuId, string contextMenuTargetId, string x, string y, ContextMenuTrigger trigger, object data)
 {
     ContextMenuId       = contextMenuId;
     ContextMenuTargetId = contextMenuTargetId;
     ContextMenuTrigger  = trigger;
     Data = data;
     X    = x;
     Y    = y;
 }
Beispiel #4
0
 public ItemClickEventArgs(MouseEventArgs mouseEvent, string contextMenuId, string contextMenuTargetId,
                           ContextMenuTrigger trigger, ElementReference menuItemElement, Item menuItem, object data)
 {
     MouseEvent          = mouseEvent;
     ContextMenuId       = contextMenuId;
     ContextMenuTargetId = contextMenuTargetId;
     ContextMenuTrigger  = trigger;
     MenuItemElement     = menuItemElement;
     MenuItem            = menuItem;
     Data = data;
 }
Beispiel #5
0
 public ItemAppearingEventArgs(string contextMenuId, string contextMenuTargetId,
                               ContextMenuTrigger trigger, Item menuItem, bool isVisible,
                               bool isEnabled, object data)
 {
     ContextMenuId       = contextMenuId;
     ContextMenuTargetId = contextMenuTargetId;
     ContextMenuTrigger  = trigger;
     MenuItem            = menuItem;
     IsEnabled           = isEnabled;
     Data      = data;
     IsVisible = isVisible;
 }