예제 #1
0
 public virtual bool ShowContextMenu(IContextMenuProvider contextMenuProvider, Point location)
 {
   if (this.rootElement == null)
     return false;
   RadDropDownMenu radDropDownMenu = contextMenuProvider.ContextMenu ?? contextMenuProvider.MergeMenus((IContextMenuManager) this);
   GridViewContextMenuManager.UpdateMenuTheme((GridVisualElement) this.rootElement, radDropDownMenu);
   ContextMenuOpeningEventArgs args = new ContextMenuOpeningEventArgs(contextMenuProvider, radDropDownMenu);
   this.rootElement.Template.EventDispatcher.RaiseEvent<ContextMenuOpeningEventArgs>(EventDispatcher.ContextMenuOpening, (object) contextMenuProvider, args);
   RadDropDownMenu contextMenu = args.ContextMenu;
   if (args.Cancel || contextMenu == null || contextMenu.Items.Count == 0)
     return false;
   if (this.rootElement.RightToLeft)
   {
     contextMenu.RightToLeft = RightToLeft.Yes;
   }
   else
   {
     contextMenu.RightToLeft = RightToLeft.No;
     contextMenu.HorizontalPopupAlignment = HorizontalPopupAlignment.LeftToLeft;
   }
   contextMenu.Show(this.rootElement.ElementTree.Control, location);
   this.contextMenu = contextMenu;
   this.contextMenu.PopupClosed += new RadPopupClosedEventHandler(this.ContextMenu_PopupClosed);
   return true;
 }
예제 #2
0
        protected virtual RadDropDownMenu CreateFilterMenu(System.Type dataType)
        {
            FilterDescriptor          descriptor       = this.Descriptor;
            CompositeFilterDescriptor filterDescriptor = descriptor as CompositeFilterDescriptor;

            CompositeFilterDescriptor.DescriptorType descriptorType = CompositeFilterDescriptor.GetDescriptorType(filterDescriptor);
            RadDropDownMenu menu = new RadDropDownMenu();
            List <FilterOperationContext> filterOperations = FilterOperationContext.GetFilterOperations(dataType);
            bool flag = this.ColumnInfo is GridViewMultiComboBoxColumn;

            foreach (FilterOperationContext context in filterOperations)
            {
                if (!flag || context.Operator == FilterOperator.None || (context.Operator == FilterOperator.IsEqualTo || context.Operator == FilterOperator.IsNotEqualTo))
                {
                    RadFilterOperationMenuItem operationMenuItem = new RadFilterOperationMenuItem(context);
                    operationMenuItem.IsChecked = filterDescriptor == null && operationMenuItem.Operator == descriptor.Operator;
                    operationMenuItem.Click    += new EventHandler(this.FilterMenuItem_Click);
                    menu.Items.Add((RadItem)operationMenuItem);
                }
            }
            if (GridViewHelper.IsNumeric(dataType) || (object)dataType == (object)typeof(DateTime))
            {
                RadFilterComposeMenuItem filterComposeMenuItem1 = new RadFilterComposeMenuItem("FilterFunctionsBetween");
                filterComposeMenuItem1.IsChecked        = filterDescriptor != null && descriptorType == CompositeFilterDescriptor.DescriptorType.Between;
                filterComposeMenuItem1.FilterDescriptor = (FilterDescriptor)this.GetCompositeFilterDescriptor(CompositeFilterDescriptor.DescriptorType.Between, filterDescriptor, dataType);
                filterComposeMenuItem1.Click           += new EventHandler(this.FilterMenuItem_Click);
                menu.Items.Add((RadItem)filterComposeMenuItem1);
                RadFilterComposeMenuItem filterComposeMenuItem2 = new RadFilterComposeMenuItem("FilterFunctionNotBetween");
                filterComposeMenuItem2.IsChecked        = descriptorType == CompositeFilterDescriptor.DescriptorType.NotBetween;
                filterComposeMenuItem2.FilterDescriptor = (FilterDescriptor)this.GetCompositeFilterDescriptor(CompositeFilterDescriptor.DescriptorType.NotBetween, filterDescriptor, dataType);
                filterComposeMenuItem2.Click           += new EventHandler(this.FilterMenuItem_Click);
                menu.Items.Add((RadItem)filterComposeMenuItem2);
            }
            if ((object)dataType != (object)typeof(Image))
            {
                RadFilterComposeMenuItem filterComposeMenuItem = new RadFilterComposeMenuItem("FilterFunctionsCustom");
                filterComposeMenuItem.FilterDescriptor = descriptor.Clone() as FilterDescriptor;
                filterComposeMenuItem.Click           += new EventHandler(this.FilterMenuItem_Click);
                filterComposeMenuItem.IsChecked        = filterDescriptor != null && descriptorType == CompositeFilterDescriptor.DescriptorType.Unknown;
                menu.Items.Add((RadItem)filterComposeMenuItem);
            }
            menu.PopupOpening += new RadPopupOpeningEventHandler(this.contextMenu_PopupOpening);
            menu.PopupClosed  += new RadPopupClosedEventHandler(this.contextMenu_PopupClosed);
            GridViewContextMenuManager.UpdateMenuTheme((GridVisualElement)this.GridViewElement, menu);
            return(menu);
        }