• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controls.Menu类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CheckTheWindowStyle

        public CheckTheWindowStyle()
        {
            Title = "Check the Window Style";

            DockPanel dock = new DockPanel();
            Content = dock;

            Menu menu = new Menu();
            dock.Children.Add(menu);
            DockPanel.SetDock(menu, Dock.Top);

            TextBlock text = new TextBlock();
            text.Text = Title;
            text.FontSize = 32;
            text.TextAlignment = TextAlignment.Center;
            dock.Children.Add(text);

            MenuItem itemStyle = new MenuItem();
            itemStyle.Header = "_Style";
            menu.Items.Add(itemStyle);

            itemStyle.Items.Add(CreateMenuItem("_No border or caption", WindowStyle.None));
            itemStyle.Items.Add(CreateMenuItem("_Single-border window", WindowStyle.SingleBorderWindow));
            itemStyle.Items.Add(CreateMenuItem("3_D-border window", WindowStyle.ThreeDBorderWindow));
            itemStyle.Items.Add(CreateMenuItem("_Tool window", WindowStyle.ToolWindow));
        }
开发者ID:JianchengZh,项目名称:kasicass,代码行数:26,代码来源:CheckTheWindowStyle.cs


示例2: ViewLoadedParams

 internal ViewLoadedParams(DynamoView dynamoV, DynamoViewModel dynamoVM) :
     base(dynamoVM.Model)
 {
     dynamoView = dynamoV;
     dynamoViewModel = dynamoVM;
     dynamoMenu = dynamoView.titleBar.ChildOfType<Menu>();
 }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:7,代码来源:ViewLoadedParams.cs


示例3: AddHelpMenu

        //--------------- 메뉴바에 Help 컬렉션 만들기 -----------------
        void AddHelpMenu(Menu menu)
        {
            //------------------------------------------------------------------
            // 메뉴의 컨트롤의 선택가능한 부분 만들기 (Help 항목 생성)
            MenuItem itemHelp = new MenuItem();

            // 만들 메뉴 이름 설정
            itemHelp.Header = "_Help";

            // 메뉴바의 Help부분을 클릭 했을때 서브 메뉴가 열린다.
            // ViewOnOpen => NotepadClone.View.cs
            itemHelp.SubmenuOpened += ViewOnOpen;

            // 메뉴에 추가
            menu.Items.Add(itemHelp);
            //------------------------------------------------------------------

            //------------------------------------------------------------------
            // About 메뉴 아이템 객체 생성
            MenuItem itemAbout = new MenuItem();

            // 만들 서브 메뉴의 이름 설정
            itemAbout.Header = "_About" + strAppTitle + ". . .";

            // 서브메뉴 클릭 이벤트
            // AboutOnClick => NotepadClone.View.cs
            itemAbout.Click += AboutOnClick;

            // 위에서 만든 Help 메뉴 안에 서브메뉴 추가
            itemHelp.Items.Add(itemAbout);
            //------------------------------------------------------------------
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:33,代码来源:NotepadClone.Help.cs


示例4: UC_CONTROLE_Documents

 public UC_CONTROLE_Documents()
 {
     InitializeComponent();
     myDisplayArea = new DisplayArea(this);
     myMenu = new Menu(this);
     myMenu.changeMenuItems();
 }
开发者ID:0ups,项目名称:dOnuts-InterfaceTablette,代码行数:7,代码来源:UC_CONTROLE_Documents.xaml.cs


示例5: When_adding_menu_item_should_be_able_to_add_to_root_menu

        public void When_adding_menu_item_should_be_able_to_add_to_root_menu()
		{
            Menu menu = new Menu { Name = "MainMenu" };
            menu.AddMenuItems(new MenuItemData { Parent = "MainMenu" });

            Assert.AreEqual(1, menu.Items.Count);
        }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:7,代码来源:MenuExtensionsFixture.cs


示例6: MainWindow

		public MainWindow ()
		{
			Title = "Mono Windows Presentation Foundation utility";

			MenuItem color_finder_menu = new MenuItem ();
			color_finder_menu.Header = "_Color finder";
			color_finder_menu.Click += delegate (object sender, RoutedEventArgs e)
			{
				new ColorFinder.ColorFinderWindow ().Show ();
			};

			MenuItem visual_structure_viewer_menu = new MenuItem ();
			visual_structure_viewer_menu.Header = "_Visual structure viewer";
			visual_structure_viewer_menu.Click += delegate (object sender, RoutedEventArgs e)
			{
				new VisualStructureViewer.VisualStructureViewerWindow ().Show ();
			};

			MenuItem utilities_menu = new MenuItem ();
			utilities_menu.Header = "_Utilities";
			utilities_menu.Items.Add (color_finder_menu);
			utilities_menu.Items.Add (visual_structure_viewer_menu);

			Menu menu = new Menu ();
			menu.Items.Add (utilities_menu);

			DockPanel contents = new DockPanel ();
			contents.LastChildFill = false;
			DockPanel.SetDock (menu, Dock.Top);
			contents.Children.Add (menu);

			Content = contents;
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:33,代码来源:MainWindow.cs


示例7: AddFormatMenu

        void AddFormatMenu(Menu menu)
        {
            //탑 레벨 Format 항목 생성
            MenuItem itemFormat = new MenuItem();
            itemFormat.Header = "F_ormat";
            menu.Items.Add(itemFormat);

            //자동 줄바꿈 메뉴 항목 생성
            WordWrapMenuItem itemWrap = new WordWrapMenuItem();
            itemFormat.Items.Add(itemWrap);

            //TextWrapping 프로퍼티 항목과 텍스트 박스를 바인딩

            //TextWrapping 프로퍼티와 WordWramenuItem의 WordWrap프로퍼티를 바인딩하기 위해 Binding 객체 생성.
            Binding bind = new Binding();
            bind.Path = new PropertyPath(TextBox.TextWrappingProperty);
            // 데이터 소스 설정.
            bind.Source = txtbox;
            //바인팅 모드 : 타킷도 소스에 반영할수 있도록 TwoWay 설정.
            bind.Mode = BindingMode.TwoWay;
            //TextBox의 SetBinding 메소드를 호출.
            itemWrap.SetBinding(WordWrapMenuItem.WordWrapProperty, bind);

            //Font 메뉴 항목생성
            MenuItem itemFont = new MenuItem();
            itemFont.Header = "_Font...";
            itemFont.Click +=FontOnClick;
            itemFormat.Items.Add(itemFont);
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:29,代码来源:www.cs


示例8: CutCopyPaste

        //[STAThread]
        //public static void Main()
        //{
        //    Application app = new Application();
        //    app.Run(new CutCopyPaste());
        //}
        public CutCopyPaste()
        {
            Title = "Cut ,Copy,and Paste";
            //DockPanel   생성
            DockPanel dock = new DockPanel();
            Content = dock;

            //탑 메뉴가 될 Menu 생성
            Menu menu = new Menu();
            dock.Children.Add(menu);
            DockPanel.SetDock(menu, Dock.Top);

            //나머지 영역을 채울 TextBlock을 생성
            text = new TextBlock();
            text.Text = "Sample clipboard text";
            text.FontSize = 32;
            text.HorizontalAlignment = HorizontalAlignment.Center;
            text.VerticalAlignment = VerticalAlignment.Center;
            text.TextWrapping = TextWrapping.Wrap;
            dock.Children.Add(text);

            //Edit 메뉴 생성
            MenuItem itemEdit = new MenuItem();
            itemEdit.Header = "_Edit";
            itemEdit.SubmenuOpened += EditOnOpened;
            menu.Items.Add(itemEdit);

            //Edit 메뉴 항목 생성
            itemCut = new MenuItem();
            itemCut.Header = "Cu_t";
            itemCut.Click += CutOnClick;
            Image img = new Image();
            img.Source = new BitmapImage(new Uri("http://image-0.poco.cn/pic_center/img/099/0836c2fc677eb3400a0049b746a5b308_640.jpg"));
            itemCut.Icon = img;
            itemEdit.Items.Add(itemCut);

            itemCopy = new MenuItem();
            itemCopy.Header = "_Copy";
            itemCopy.Click += CopyOnClick;
            img = new Image();
            img.Source = new BitmapImage(new Uri("http://www.onegreen.net/QQ/UploadFiles/200806/200861551027277.gif"));
            itemCopy.Icon = img;
            itemEdit.Items.Add(itemCopy);

            itemPaste = new MenuItem();
            itemPaste.Header = "_Paste";
            itemPaste.Click += PasteOnClick;
            img = new Image();
            img.Source = new BitmapImage(new Uri("http://www.onegreen.net/QQ/UploadFiles/200806/200861551027422.gif"));
            itemPaste.Icon = img;
            itemEdit.Items.Add(itemPaste);

            itemDelete = new MenuItem();
            itemDelete.Header = "_Delete";
            itemDelete.Click += DeleteOnClick;
            img = new Image();
            img.Source = new BitmapImage(new Uri("http://www.onegreen.net/QQ/UploadFiles/200806/200861551027518.jpg"));
            itemDelete.Icon = img;
            itemEdit.Items.Add(itemDelete);
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:66,代码来源:CutCopyPaste.cs


示例9: Loaded

        public void Loaded(ViewLoadedParams p)
        {
            if (publishViewModel == null || inviteViewModel == null)
                return;

            publishViewModel.Workspaces = p.WorkspaceModels;
            publishViewModel.CurrentWorkspaceModel = p.CurrentWorkspaceModel;

            dynamoMenu = p.dynamoMenu;
            extensionMenuItem = GenerateMenuItem();
            p.AddMenuItem(MenuBarType.File, extensionMenuItem, 11);

            manageCustomizersMenuItem = GenerateManageCustomizersMenuItem();
            p.AddMenuItem(MenuBarType.File, manageCustomizersMenuItem, 12);

            inviteMenuItem = GenerateInviteMenuItem();
            p.AddMenuItem(MenuBarType.File, inviteMenuItem, 11);

            p.AddSeparator(MenuBarType.File, separator, 14);

            p.CurrentWorkspaceChanged += (ws) =>
            {
                publishViewModel.CurrentWorkspaceModel = ws;

                var isEnabled = ws is HomeWorkspaceModel && publishModel.HasAuthProvider;
                extensionMenuItem.IsEnabled = isEnabled;
            };

        }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:29,代码来源:DynamoPublishExtension.cs


示例10: Attach

        protected override void Attach()
        {
            _control = ControlObject as Menu;
            List<MenuItem> items = new List<MenuItem>();
            HeaderedItemsControlUtility.GetChildren(_control, items);
            foreach (var element in items)
            {
                var item = element;
                string text = HeaderedItemsControlUtility.GetItemText(item);
                if (string.IsNullOrEmpty(text))
                {
                    continue;
                }

                RoutedEventHandler opened = (s, e) =>
                {
                    SubmenuOpened(item, new string[] { text });
                };
                item.SubmenuOpened += opened;

                RoutedEventHandler click = (s, e) =>
                {
                    Click(item, new string[] { text });
                };
                item.Click += click;
                _detach.Add(() =>
                {
                    item.SubmenuOpened -= opened;
                    item.Click -= click;
                });
            }
        }
开发者ID:Roommetro,项目名称:Friendly.WPFStandardControls,代码行数:32,代码来源:WPFMenuBaseGenerator.cs


示例11: CommandTheMenu

        public CommandTheMenu()
        {
            Title = "Command The Menu";

            DockPanel dock = new DockPanel();
            Content = dock;

            Menu menu = new Menu();
            dock.Children.Add(menu);
            DockPanel.SetDock(menu, Dock.Top);

            text = new TextBlock();
            text.Text = "Sample clipboard text";
            text.HorizontalAlignment = HorizontalAlignment.Center;
            text.VerticalAlignment = VerticalAlignment.Center;
            text.FontSize = 32;
            text.TextWrapping = TextWrapping.Wrap;
            dock.Children.Add(text);

            MenuItem itemEdit = new MenuItem();
            itemEdit.Header = "_Edit";
            menu.Items.Add(itemEdit);

            MenuItem itemCut = new MenuItem();
            itemCut.Header = "Cu_t";
            itemCut.Command = ApplicationCommands.Cut;
            itemEdit.Items.Add(itemCut);

            MenuItem itemCopy = new MenuItem();
            itemCopy.Header = "_Copy";
            itemCopy.Command = ApplicationCommands.Copy;
            itemEdit.Items.Add(itemCopy);

            MenuItem itemPaste = new MenuItem();
            itemPaste.Header = "_Paste";
            itemPaste.Command = ApplicationCommands.Paste;
            itemEdit.Items.Add(itemPaste);

            MenuItem itemDelete = new MenuItem();
            itemDelete.Header = "_Delete";
            itemDelete.Command = ApplicationCommands.Delete;
            itemEdit.Items.Add(itemDelete);

            // new command
            InputGestureCollection collGestures = new InputGestureCollection();
            collGestures.Add(new KeyGesture(Key.R, ModifierKeys.Control));
            RoutedUICommand commRestore = new RoutedUICommand("_Restore", "Restore", GetType(), collGestures);

            MenuItem itemRestore = new MenuItem();
            itemRestore.Header = "_Restore";
            itemRestore.Command = commRestore;
            itemEdit.Items.Add(itemRestore);

            CommandBindings.Add(new CommandBinding(ApplicationCommands.Cut, CutOnExecute, CutCanExecute));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, CopyOnExecute, CutCanExecute));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Paste, PasteOnExecute, PasteCanExecute));
            CommandBindings.Add(new CommandBinding(ApplicationCommands.Delete, DeleteOnExecute, CutCanExecute));
            CommandBindings.Add(new CommandBinding(commRestore, RestoreOnExecute));
        }
开发者ID:JianchengZh,项目名称:kasicass,代码行数:59,代码来源:CommandTheMenu.cs


示例12: AddFileMenu

        // File �޴� �ʱ�ȭ
        void AddFileMenu(Menu menu)
        {
            //============================================================
            // ž ���� ���� �׸� ����
            //============================================================
            MenuItem itemFile = new MenuItem();
            // ��� ����
            itemFile.Header = "_File";
            // Main �޴��� ������(Top Menu) ����
            menu.Items.Add(itemFile);

            // New �޴� �׸� ���� �� Top�޴� File�� �߰�
            MenuItem itemNew = new MenuItem();
            itemNew.Header = "_New";
            itemNew.Command = ApplicationCommands.New;
            itemFile.Items.Add(itemNew);
            CommandBindings.Add(
                new CommandBinding(ApplicationCommands.New, NewOnExecute));

            // Open  �޴� �׸� ���� �� Top�޴� File�� �߰�
            MenuItem itemOpen = new MenuItem();
            itemOpen.Header = "_Open...";
            // Command ����
            itemOpen.Command = ApplicationCommands.Open;
            itemFile.Items.Add(itemOpen);
            // CommandBing�� ���� �̺�Ʈ ��� Open�� OpenOnExecute�Լ� ����
            CommandBindings.Add(
                new CommandBinding(ApplicationCommands.Open, OpenOnExecute));

            // Save  �޴� �׸� ���� �� Top�޴� File�� �߰�
            MenuItem itemSave = new MenuItem();
            itemSave.Header = "_Save";
            itemSave.Command = ApplicationCommands.Save;
            itemFile.Items.Add(itemSave);
            CommandBindings.Add(
                new CommandBinding(ApplicationCommands.Save, SaveOnExecute));

            // Save As  �޴� �׸� ���� �� Top�޴� File�� �߰�
            MenuItem itemSaveAs = new MenuItem();
            itemSaveAs.Header = "Save _As...";
            itemSaveAs.Command = ApplicationCommands.SaveAs;
            itemFile.Items.Add(itemSaveAs);
            CommandBindings.Add(
                new CommandBinding(ApplicationCommands.SaveAs, SaveAsOnExecute));

            // ������(Separators) ����
            itemFile.Items.Add(new Separator());

            // PrintMenu�� �߰��ϴ� �Լ� ȣ��(1������ �˾Ƽ�/ NotepadClone.Print.cs�� ����)
            AddPrintMenuItems(itemFile);
            itemFile.Items.Add(new Separator());

            // Exit  �޴� �׸� ���� �� Top�޴� File�� �߰�
            MenuItem itemExit = new MenuItem();
            itemExit.Header = "E_xit";
            itemExit.Click += ExitOnClick;
            itemFile.Items.Add(itemExit);
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:59,代码来源:NotepadClone.File.cs


示例13: Restart

 public Restart(Menu menuToReturnTo, int s)
 {
     InitializeComponent();
     menu = menuToReturnTo;
     Image image = new Image();
     image.Source = new BitmapImage(new Uri(Directory.GetCurrentDirectory() + @"\..\..\Resources\[email protected]", UriKind.Absolute));
     backgroundImage.ImageSource = image.Source;
     Score.Text = s.ToString(); 
 }
开发者ID:EECS481MatchingGame,项目名称:GroupProject,代码行数:9,代码来源:Restart.xaml.cs


示例14: ViewLoadedParams

        internal ViewLoadedParams(DynamoView dynamoV, DynamoViewModel dynamoVM) :
            base(dynamoVM.Model)
        {
            dynamoView = dynamoV;
            dynamoViewModel = dynamoVM;
            dynamoMenu = dynamoView.titleBar.ChildOfType<Menu>();

            DynamoSelection.Instance.Selection.CollectionChanged += OnSelectionCollectionChanged;
        }
开发者ID:joespiff,项目名称:Dynamo,代码行数:9,代码来源:ViewLoadedParams.cs


示例15: When_adding_menu_items_should_be_able_to_add_to_child_menu_item

        public void When_adding_menu_items_should_be_able_to_add_to_child_menu_item()
		{
            Menu menu = new Menu { Name = "MainMenu" };
            MenuItem child = new MenuItem { Name = "Child" };
            menu.Items.Add(child);
            menu.AddMenuItems(new MenuItemData { Parent = "Child" });

            Assert.AreEqual(1, child.Items.Count);
        }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:9,代码来源:MenuExtensionsFixture.cs


示例16: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.MenuAction = ((System.Windows.Controls.Menu)(target));
     return;
     case 2:
     
     #line 10 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeToENG);
     
     #line default
     #line hidden
     return;
     case 3:
     
     #line 11 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ChangeToPL);
     
     #line default
     #line hidden
     return;
     case 4:
     
     #line 16 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ShowAddRecepieWindow);
     
     #line default
     #line hidden
     return;
     case 5:
     
     #line 17 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ShowAddComponentWindow);
     
     #line default
     #line hidden
     return;
     case 6:
     
     #line 20 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ShowSearchRecipeWindow);
     
     #line default
     #line hidden
     return;
     case 7:
     
     #line 23 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.ShowMigrationB2B);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:leytoon,项目名称:MyPrograms,代码行数:57,代码来源:MainWindow.g.i.cs


示例17: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.MainMenu = ((System.Windows.Controls.Menu)(target));
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:MindTheGap,项目名称:BTrader,代码行数:9,代码来源:MainWindow.g.i.cs


示例18: TitleMenuItem

		public TitleMenuItem (MonoDevelop.Components.Commands.CommandManager manager, CommandEntry entry, CommandInfo commandArrayInfo = null, CommandSource commandSource = CommandSource.MainMenu, object initialCommandTarget = null, Menu menu = null)
		{
			this.manager = manager;
			this.initialCommandTarget = initialCommandTarget;
			this.commandSource = commandSource;
			this.commandArrayInfo = commandArrayInfo;

			this.menu = menu;
			menuEntry = entry;
			menuEntrySet = entry as CommandEntrySet;
			menuLinkEntry = entry as LinkCommandEntry;

			if (commandArrayInfo != null) {
				Header = commandArrayInfo.Text;

				var commandArrayInfoSet = commandArrayInfo as CommandInfoSet;
				if (commandArrayInfoSet != null) {
					foreach (var item in commandArrayInfoSet.CommandInfos) {
						if (item.IsArraySeparator)
							Items.Add (new Separator { UseLayoutRounding = true, });
						else
							Items.Add (new TitleMenuItem (manager, entry, item, commandSource, initialCommandTarget, menu));
					}
				}
			}

			if (menuEntrySet != null) {
				Header = menuEntrySet.Name;

				foreach (CommandEntry item in menuEntrySet) {
					if (item.CommandId == MonoDevelop.Components.Commands.Command.Separator) {
						Items.Add (new Separator { UseLayoutRounding = true, });
					} else
						Items.Add (new TitleMenuItem (manager, item, menu: menu));
				}
			} else if (menuLinkEntry != null) {
				Header = menuLinkEntry.Text;
				Click += OnMenuLinkClicked;
			} else if (entry != null) {
				actionCommand = manager.GetCommand (menuEntry.CommandId) as ActionCommand;
				if (actionCommand == null)
					return;

				IsCheckable = actionCommand.ActionType == ActionType.Check;

				// FIXME: Use proper keybinding text.
				if (actionCommand.KeyBinding != null)
					InputGestureText = actionCommand.KeyBinding.ToString ();
				
				if (!actionCommand.Icon.IsNull)
					Icon = new Image { Source = actionCommand.Icon.GetImageSource (Xwt.IconSize.Small) };
				Click += OnMenuClicked;
			}

			Height = SystemParameters.CaptionHeight;
			UseLayoutRounding = true;
		}
开发者ID:ArsenShnurkov,项目名称:monodevelop,代码行数:57,代码来源:TitleMenuItem.cs


示例19: MenuController

 public MenuController(Menu menu, ToolBarTray toolBarTray)
 {
     _menu = menu;
     _toolBarTray = toolBarTray;
     _menuItems = new List<MingMenuItemAndHandler>();
     _contextMenuItems = new List<object>();
     _contextMenuKeyProviders = new List<ITreeViewContextMenuClient>();
     _menuClients = new List<IMingMenuClient>();
     _pluginTabDocumentItems = new Dictionary<string, IList<string>>();
 }
开发者ID:stevehjohn,项目名称:Hub,代码行数:10,代码来源:MenuController.cs


示例20: When_adding_menu_item_and_the_parent_does_not_exist_should_ignore_addition

        public void When_adding_menu_item_and_the_parent_does_not_exist_should_ignore_addition()
		{
            Menu menu = new Menu { Name = "MainMenu" };
            MenuItem child = new MenuItem { Name = "Child" };
            menu.Items.Add(child);
            menu.AddMenuItems(new MenuItemData { Parent = "Grandchild" });

            Assert.AreEqual(1, menu.Items.Count);
            Assert.AreEqual(0, child.Items.Count);
        }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:10,代码来源:MenuExtensionsFixture.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Controls.MenuItem类代码示例发布时间:2022-05-26
下一篇:
C# Controls.MediaElement类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap