当前位置: 首页>>代码示例>>C#>>正文


C# RadMenuItem类代码示例

本文整理汇总了C#中RadMenuItem的典型用法代码示例。如果您正苦于以下问题:C# RadMenuItem类的具体用法?C# RadMenuItem怎么用?C# RadMenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RadMenuItem类属于命名空间,在下文中一共展示了RadMenuItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RadContextMenu_Opened

        private void RadContextMenu_Opened(object sender, RoutedEventArgs e)
        {
            var menu = (RadContextMenu) sender;
            menu.Items.Clear();
            var row = menu.GetClickedElement<GridViewRow>();

            if (row != null)
            {
                row.IsSelected = row.IsCurrent = true;
                var cell = menu.GetClickedElement<GridViewCell>();
                if (cell != null)
                {
                    cell.IsCurrent = true;
                    var purchaseOrderAccure = row.DataContext as PurchaseOrderAccureModel;

                    if (purchaseOrderAccure != null && cell.Column.Header.ToString() == "Accrue") //make sure this opens only on Accrue Columns
                    {
                        var iconImage = new Image { Source = new BitmapImage(new Uri(@"/CmsEquipmentDatabase;component/Images/Tools.Copy.png", UriKind.Relative)) };
                        var rmi = new RadMenuItem { Header = "Copy Undelivered amount to Accrue", Icon = iconImage };
                        rmi.IsEnabled = true;
                        rmi.Click += (s, args) =>
                        {
                            purchaseOrderAccure.Accrue = purchaseOrderAccure.UndeliveredPortion.ToString();
                            purchaseOrderAccure.RaisePropertyChanged("Accrue");
                        };
                        menu.Items.Add(rmi);
                    }
                }
                else
                {
                    menu.IsOpen = false;
                }
            }
        }
开发者ID:barrett2474,项目名称:CMS2,代码行数:34,代码来源:AddEditPurchaseOrderDialog.xaml.cs

示例2: AddCourseMenuItems

        private void AddCourseMenuItems()
        {
            var courses = Thinkgate.Base.Classes.Course.GetCourses();

            var grades = courses.Select(x => x.Grade.DisplayText).Distinct();

            foreach (string displayText in grades)
            {
                var gradeMenuItem = new RadMenuItem(displayText);
                coursesMenu.Items.Add(gradeMenuItem);

                var gradeSubjects = courses.Where(x => x.Grade.DisplayText == displayText).Select(x => x.Subject.DisplayText).Distinct();

                foreach (string subject in gradeSubjects)
                {
                    var subjectMenuItem = new RadMenuItem(subject);
                    gradeMenuItem.Items.Add(subjectMenuItem);

                    var subjectCourses = courses.Where(x => x.Grade.DisplayText == displayText 
                                                            && x.Subject.DisplayText == subject).Select(x => x.CourseName).Distinct();

                    foreach (string course in subjectCourses)
                    {
                        subjectMenuItem.Items.Add(new RadMenuItem(course));
                    }
                }
            }
        }
开发者ID:ezimaxtechnologies,项目名称:ASP.Net,代码行数:28,代码来源:CourseSelector.ascx.cs

示例3: ToggleShowHide

 private static void ToggleShowHide(RadMenuItem menuItem, string from, string to)
 {
     if (menuItem.Header != null)
     {
         menuItem.Header = menuItem.Header.ToString().Replace(from, to);
     }
 }
开发者ID:netthanhhung,项目名称:Medical,代码行数:7,代码来源:ExtensionsTelerikSilverlight.cs

示例4: AddCustomContextMenuItem

        private void AddCustomContextMenuItem()
        {
            DelegateCommand highlightCommand = null;

            Action<object> highlightCommandAction = new Action<object>((parameter) =>
            {
                this.radSpreadsheet.ActiveWorksheetEditor.Selection.Cells.SetFill(highlightFill);
                highlightCommand.InvalidateCanExecute();
            });

            Predicate<object> highlightCommandPredicate = new Predicate<object>((obj) =>
            {
                RadWorksheetEditor editor = this.radSpreadsheet.ActiveWorksheetEditor;
                if (editor != null)
                {
                    PatternFill patternFill = editor.Worksheet.Cells[editor.Selection.ActiveRange.SelectedCellRange].GetFill().Value as PatternFill;
                    if (patternFill != null)
                    {
                        return !patternFill.Equals(highlightFill);
                    }
                }

                return false;
            });

            highlightCommand = new SelectionDependentCommand(this.radSpreadsheet, highlightCommandAction, highlightCommandPredicate);

            RadMenuItem newItem = new RadMenuItem();
            newItem.Header = ContextMenuItemHeader;
            newItem.Command = highlightCommand;

            this.radSpreadsheet.WorksheetEditorContextMenu.Items.Add(newItem);
        }
开发者ID:hnaino,项目名称:xaml-sdk,代码行数:33,代码来源:MainWindow.xaml.cs

示例5: Page_Init

        protected new void Page_Init(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                /********************************************************************
                 * Set up banner for Item Page to display the following actions
                 * as menu options:
                 *          Copy    - Copies current item into User's personal Bank
                 *          Delete  - Deletes the current Item from the system.
                 * *****************************************************************/
                var siteMaster = this.Master as SiteMaster;
                if (siteMaster != null)
                {
                    siteMaster.BannerType = BannerType.ObjectScreen;
                    _miDelete = new RadMenuItem("Delete");
                    siteMaster.Banner.AddMenuItem(Banner.ContextMenu.Actions, _miDelete);
                    siteMaster.Banner.AddOnClientItemClicked(Banner.ContextMenu.Actions, "actionsMenuItemClicked");
                }

                SessionObject = (SessionObject)Session["SessionObject"];
                SetupFolders();
                InitPage(ctlFolders, ctlDoublePanel, sender, e);
                LoadRubric();
                if (_selectedRubric == null) return;
                if (!IsPostBack)
                {
                    SessionObject.ClickedInformationControl = "Identification";
                }

                LoadDefaultFolderTiles();
                SetHeaderImageUrl();
            }
        }
开发者ID:ezimaxtechnologies,项目名称:ASP.Net,代码行数:33,代码来源:RubricPage.aspx.cs

示例6: InitializeGridContextMenu

 private void InitializeGridContextMenu()
 {
     librosContextMenu = new RadDropDownMenu();
     var rmiClientesConsignacion = new RadMenuItem("Clientes Consig.");
     rmiClientesConsignacion.Click += rmiClientesConsignacion_Click;
     librosContextMenu.Items.Add(rmiClientesConsignacion);
 }
开发者ID:pragmasolutions,项目名称:Libreria,代码行数:7,代码来源:FrmLibrosListado.cs

示例7: Construct

        public virtual ContextMenuGroup Construct()
        {
            var spellCheckSuggestions = new ContextMenuGroup(ContextMenuGroupType.SpellCheckingCommands);
            var word = _incorrectWordInfo.Word;
            if (!_radRichTextBox.SpellChecker.CheckWordIsCorrect(word))
            {
                AddSpellCheckingSuggestions(spellCheckSuggestions, word);
                spellCheckSuggestions.Add(new RadMenuItem { IsSeparator = true });
                var radMenuItem1 = new RadMenuItem
                                       {
                                           Header = LocalizationManager.GetString("Documents_ContextMenu_SpellChecker_AddToDictionary"),
                                           IsEnabled = _radRichTextBox.SpellChecker.CanAddWord()
                                       };
                radMenuItem1.Click += AddToDictionaryMenuItem_Click;
                spellCheckSuggestions.Add(radMenuItem1);
                var radMenuItem2 = new RadMenuItem { Header = LocalizationManager.GetString("Documents_ContextMenu_SpellChecker_IgnoreWord") };
                radMenuItem2.Click += IgnoreMenuItem_Click;
                spellCheckSuggestions.Add(radMenuItem2);
                var radMenuItem3 = new RadMenuItem { Header = LocalizationManager.GetString("Documents_ContextMenu_SpellChecker_IgnoreAll") };
                radMenuItem3.Click += IgnoreAllMenuItem_Click;
                spellCheckSuggestions.Add(radMenuItem3);
                var menuItem = CreateMenuItem(LocalizationManager.GetString("Documents_ContextMenu_SpellChecker_ShowSpellCheckingDialog"), "16/EnableSpellCheck.png", _radRichTextBox.Commands.ShowSpellCheckingDialogCommand);
                spellCheckSuggestions.Add(menuItem);
            }

            return spellCheckSuggestions;
        }
开发者ID:mparsin,项目名称:Elements,代码行数:27,代码来源:CustomSpellCheckerMenuBuilder.cs

示例8: OnMenuOpened

        void OnMenuOpened(object sender, RoutedEventArgs e)
        {
            RadContextMenu menu = (RadContextMenu) sender;
            GridViewHeaderCell cell = menu.GetClickedElement<GridViewHeaderCell>();

            if (cell != null)
            {
                menu.Items.Clear();

                RadMenuItem item = new RadMenuItem();
				item.Header = String.Format(@"Sort Ascending by ""{0}""", cell.Column.Header);
                menu.Items.Add(item);

                item = new RadMenuItem();
				item.Header = String.Format(@"Sort Descending by ""{0}""", cell.Column.Header);
                menu.Items.Add(item);

                item = new RadMenuItem();
				item.Header = String.Format(@"Clear Sorting by ""{0}""", cell.Column.Header);
                menu.Items.Add(item);

                item = new RadMenuItem();
				item.Header = String.Format(@"Group by ""{0}""", cell.Column.Header);
                menu.Items.Add(item);

                item = new RadMenuItem();
				item.Header = String.Format(@"Ungroup ""{0}""", cell.Column.Header);
                menu.Items.Add(item);

                item = new RadMenuItem();
				item.Header = "Choose Columns:";
                menu.Items.Add(item);

                // create menu items
                foreach (GridViewColumn column in grid.Columns)
                {
                    RadMenuItem subMenu = new RadMenuItem();
					subMenu.Header = column.Header;
					subMenu.IsCheckable = true;
					subMenu.IsChecked = true;

					Binding isCheckedBinding = new Binding("IsVisible");
					isCheckedBinding.Mode = BindingMode.TwoWay;
					isCheckedBinding.Source = column;

                    // bind IsChecked menu item property to IsVisible column property
                    subMenu.SetBinding(RadMenuItem.IsCheckedProperty, isCheckedBinding);

                    item.Items.Add(subMenu);
                }
            }
            else
            {
                menu.IsOpen = false;
            }
        }
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:56,代码来源:GridViewHeaderMenu.cs

示例9: IssueSummaryListView

        public IssueSummaryListView(List<int> ints, CommonUtils.SummaryViewType summaryType, string filterName)
        {
            InitializeComponent();
            CompositionInitializer.SatisfyImports(this);

            RadContextMenu radContextMenu = removeFavouriteContextMenu.Parent as RadContextMenu;

            if (summaryType == CommonUtils.SummaryViewType.MyFavouriteIssues)
            {
                if (radContextMenu == null)
                {
                    return;
                }

                radContextMenu.Opened += (s, e) =>
                    {
                        RadContextMenu menu = (RadContextMenu) s;
                        menu.Items.Clear();
                        GridViewRow row = menu.GetClickedElement<GridViewRow>();

                        if (row != null)
                        {
                            row.IsSelected = row.IsCurrent = true;
                            GridViewCell cell = menu.GetClickedElement<GridViewCell>();
                            if (cell != null)
                            {
                                cell.IsCurrent = true;
                                var issueSummaryDto = row.DataContext as IssueSummaryDto;
                                if (issueSummaryDto != null)
                                {
                                    var quickIssue = new QuickIssue {Id = issueSummaryDto.Id, IsActive = issueSummaryDto.IsActive};

                                    RadMenuItem rmi = new RadMenuItem {Header = "Remove from Favourites", Icon = null};
                                    rmi.IsEnabled = (CMS.EffectivePrivileges.AdminTab.CanDelete || CMS.EffectivePrivileges.IssueTab.CanView) && quickIssue.IsActive;
                                    rmi.Click += (s3, args) => RemoveFromFavourites(quickIssue);
                                    menu.Items.Add(rmi);
                                }
                            }
                        }
                        else
                        {
                            menu.IsOpen = false;
                        }
                    };
            }
            else
            {
                radContextMenu.Visibility = Visibility.Collapsed;
            }

            mViewModel = new IssueSummaryListViewModel(ints, summaryType, filterName);
            FilterName = filterName;
            SummaryType = summaryType;
            DataContext = mViewModel;
        }
开发者ID:barrett2474,项目名称:CMS2,代码行数:55,代码来源:IssueSummaryListView.xaml.cs

示例10: DataBindBreadCrumbSiteMap

 public void DataBindBreadCrumbSiteMap(RadMenuItem currentItem)
 {
     //Select the current item and his parents
     currentItem.HighlightPath();
     List<RadMenuItem> breadCrumbPath = new List<RadMenuItem>();
     while (currentItem != null)
     {
         breadCrumbPath.Insert(0, currentItem);
         currentItem = currentItem.Owner as RadMenuItem;
     }
     BreadCrumbSiteMap.DataSource = breadCrumbPath;
     BreadCrumbSiteMap.DataBind();
 }
开发者ID:KungfuCreatives,项目名称:P3WebApp,代码行数:13,代码来源:Site.Master.cs

示例11: GetMenuItemName

        /// <summary>
        /// Gets the 'name' of a menu item. Which is either: the <see cref="FrameworkElement.Tag"/>, the <see cref="RadMenuItem.Header"/> or null.
        /// </summary>
        /// <param name="menuItem">The <see cref="RadMenuItem"/> for which the 'name' is requested.</param>
        /// <returns>The 'name' string.</returns>
        private static string GetMenuItemName(RadMenuItem menuItem)
        {
            string name = null;
            if (menuItem.Tag != null)
            {
                name = Convert.ToString(menuItem.Tag, CultureInfo.InvariantCulture);
            }
            else if (menuItem.Header != null)
            {
                name = Convert.ToString(menuItem.Header, CultureInfo.InvariantCulture);
            }

            return name;
        }
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:19,代码来源:Example.xaml.cs

示例12: TreeExampleUserControl

    public TreeExampleUserControl() {
      var resources = new ComponentResourceManager(typeof(TreeExampleUserControl));
      InitializeComponent(resources);

      foreach (var image in new[] {"level1", "level2", "level3" } )
        _level.Add(((Bitmap) (resources.GetObject(image))));

      ThemeResolutionService.ApplyThemeToControlTree(this, "TelerikMetroBlue");

      var item = new RadMenuItem("None");
      item.Click += item_Click;
      radDropDownButton1.Items.Add(item);

      item = new RadMenuItem("Alphabetically");
      item.Click += item_Click;
      radDropDownButton1.Items.Add(item);

      var searchIcon = new ImagePrimitive { Image = ((Image) (resources.GetObject("TV_search"))), Alignment = ContentAlignment.MiddleRight };
      radTextBox1.TextBoxElement.Children.Add(searchIcon);
      radTextBox1.TextBoxElement.TextBoxItem.Alignment = ContentAlignment.MiddleLeft;
      radTextBox1.TextBoxElement.TextBoxItem.PropertyChanged += TextBoxItem_PropertyChanged;
      radTreeView1.TreeViewElement.AllowAlternatingRowColor = true;
      radTreeView1.AllowEdit = false;
      radTreeView1.AllowAdd = false;
      radTreeView1.AllowRemove = false;
      radTreeView1.ItemHeight = 34;
      radTreeView1.AllowDefaultContextMenu = false;

      AutoScroll = false;

      radPanel3.PanelElement.PanelFill.BackColor = Color.White;
      radPanel3.BackColor = Color.White;
      radPanel3.PanelElement.PanelFill.GradientStyle = GradientStyles.Solid;
      radPanel3.PanelElement.PanelBorder.TopColor = Color.FromArgb(196, 199, 182);
      radPanel3.PanelElement.PanelBorder.LeftColor = Color.FromArgb(196, 199, 182);
      radPanel3.PanelElement.PanelBorder.RightColor = Color.FromArgb(196, 199, 182);
      radPanel3.PanelElement.PanelBorder.BottomColor = Color.White;
      radPanel3.PanelElement.PanelBorder.BoxStyle = BorderBoxStyle.FourBorders;
      radPanel3.PanelElement.PanelBorder.BorderDrawMode = BorderDrawModes.VerticalOverHorizontal;
      radPanel3.PanelElement.PanelBorder.GradientStyle = GradientStyles.Solid;

      radPanel1.PanelElement.PanelFill.BackColor = Color.FromArgb(26, 93, 192);
      radPanel1.PanelElement.PanelFill.GradientStyle = GradientStyles.Solid;
      radPanel1.PanelElement.PanelBorder.Visibility = ElementVisibility.Collapsed;
      radPanel1.PanelElement.Font = new Font("Segoe UI Light", 20, FontStyle.Regular);
      radPanel1.ForeColor = Color.White;
      radPanel1.PanelElement.Padding = new Padding(8, 2, 2, 2);
      radPanel1.Text = @"Music Collection";
    }
开发者ID:Latency,项目名称:TINTIN-.NET,代码行数:49,代码来源:TreeExampleUserControl.cs

示例13: Launcher

 public Launcher()
 {
     Thread.CurrentThread.CurrentUICulture = new CultureInfo(Program.Lang);
     InitializeComponent();
     LoggingConfiguration.LoggingBox = Log;
     var openVer = new RadMenuItem {Text = LocRm.GetString("contextver.open")};
     openVer.Click += (sender, e) =>
     {
         try
         {
             if (string.IsNullOrEmpty(radListView1.SelectedItem[0].ToString())) return;
             Process.Start(Variables.McVersions + "/" + radListView1.SelectedItem[0] + "/");
         }
         catch
         {
         }
     };
     VerContext.Items.Add(openVer);
     VerContext.Items.Add(new RadMenuSeparatorItem());
     var delVer = new RadMenuItem {Text = LocRm.GetString("contextver.del")};
     delVer.Click += (sender, e) =>
     {
         try
         {
             if (string.IsNullOrEmpty(radListView1.SelectedItem[0].ToString())) return;
             var dr =
                 RadMessageBox.Show(
                     string.Format("{0}({1})?", LocRm.GetString("contextver.del.a"), radListView1.SelectedItem[0]),
                     LocRm.GetString("contextver.del.b"),
                     MessageBoxButtons.YesNo, RadMessageIcon.Question);
             if (dr != DialogResult.Yes) return;
             Logging.Info(string.Format("{0} {1}...", LocRm.GetString("contextver.del.progress"), radListView1.SelectedItem[0]));
             try
             {
                 Directory.Delete(string.Format("{0}/{1}/", Variables.McVersions, radListView1.SelectedItem[0]), true);
                 GetVersions();
                 GetSelectedVersion(SelectProfile.SelectedItem.Text);
             }
             catch (Exception ex)
             {
                 Logging.Error(string.Format("{0}\n{1}", LocRm.GetString("contextver.del.error"), ex));
             }
         }
         catch
         {
         }
     };
     VerContext.Items.Add(delVer);
 }
开发者ID:BLaDZer,项目名称:Luncher,代码行数:49,代码来源:Launcher.cs

示例14: AddMenuItem

        public void AddMenuItem(ContextMenu contextMenu, string parentMenuItemText, RadMenuItem menuItem)
        {
            if (!this.menuItems.ContainsKey(contextMenu))
            {
                return;
            }

            var item = this.menuItems[contextMenu].FindItemByText(parentMenuItemText);
            if (item == null)
            {
                return;
            }

            item.Items.Add(menuItem);
        }
开发者ID:ezimaxtechnologies,项目名称:ASP.Net,代码行数:15,代码来源:Banner.cs

示例15: GetMenuItemExpandedName

        /// <summary>
        /// Gets the concatinated 'names' retrieved by <see cref="GetMenuItemName"/> of the <paramref name="menuItem"/> and its <see cref="FrameworkElement.Parent"/> <see cref="RadMenuItems"/>.
        /// </summary>
        /// <param name="menuItem">The <see cref="RadMenuItem"/> for which the 'name' is requested.</param>
        /// <returns>The concatinated 'name' string.</returns>
        private static string GetMenuItemExpandedName(RadMenuItem menuItem)
        {
            string concatinatedName = string.Empty;
            while (menuItem != null)
            {
                string name = GetMenuItemName(menuItem);
                if (!string.IsNullOrEmpty(name))
                {
                    concatinatedName = name + (concatinatedName == string.Empty ? string.Empty : " / " + concatinatedName);
                }

                menuItem = menuItem.Parent as RadMenuItem;
            }

            return concatinatedName;
        }
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:21,代码来源:Example.xaml.cs


注:本文中的RadMenuItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。