Esempio n. 1
0
        protected virtual internal bool ShowContextMenu()
#endif
        {
            if (this.dataGrid == null || dataGrid.GroupDropAreaContextMenu == null)
            {
                return(false);
            }

            var menuinfo = new GridGroupDropAreaContextMenuInfo()
            {
                DataGrid = this.dataGrid
            };
            var args = new GridContextMenuEventArgs(dataGrid.GroupDropAreaContextMenu, menuinfo, RowColumnIndex.Empty, ContextMenuType.GroupDropArea, this.dataGrid);

            if (!dataGrid.RaiseGridContextMenuEvent(args))
            {
#if WPF
                if (args.ContextMenuInfo != null)
                {
                    dataGrid.GroupDropAreaContextMenu.DataContext = args.ContextMenuInfo;
                }
                dataGrid.GroupDropAreaContextMenu.PlacementTarget = this;
                dataGrid.GroupDropAreaContextMenu.IsOpen          = true;
#else
                if (args.ContextMenuInfo != null)
                {
                    foreach (var item in args.ContextMenu.Items)
                    {
                        item.DataContext = args.ContextMenuInfo;
                    }
                }
                args.ContextMenu.ShowAt(this, position);
#endif
                return(true);
            }
            return(false);
        }