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


C# IMenu.AddSubMenu方法代码示例

本文整理汇总了C#中IMenu.AddSubMenu方法的典型用法代码示例。如果您正苦于以下问题:C# IMenu.AddSubMenu方法的具体用法?C# IMenu.AddSubMenu怎么用?C# IMenu.AddSubMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMenu的用法示例。


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

示例1: OnCreateOptionsMenu

		public override bool OnCreateOptionsMenu (IMenu menu)
		{
			ISubMenu sub = menu.AddSubMenu ("Evolve");
			// group id, , order, text
			sub.Add (0, 1, 1, "What's On");
			sub.Add (0, 2, 2, "Speakers");
			sub.Add (0, 3, 3, "Sessions");

			sub.Item.SetShowAsAction (ShowAsAction.Always | ShowAsAction.WithText);
			return true;

		}
开发者ID:flolovebit,项目名称:xamarin-evolve-2014,代码行数:12,代码来源:MainActivity.cs

示例2: OnCreateOptionsMenu

		public override bool OnCreateOptionsMenu (IMenu menu)
		{
			var subMenu1 = menu.AddSubMenu ("Action Item");
			subMenu1.Add ("Sample");
			subMenu1.Add ("Menu");
			subMenu1.Add ("Items");

			var subMenu1Item = subMenu1.Item;
			subMenu1Item.SetIcon (Resource.Drawable.ic_title_share_default);
			subMenu1Item.SetShowAsAction (MenuItem.ShowAsActionAlways | MenuItem.ShowAsActionWithText);

			var subMenu2 = menu.AddSubMenu ("Overflow Item");
			subMenu2.Add ("These");
			subMenu2.Add ("Are");
			subMenu2.Add ("Sample");
			subMenu2.Add ("Items");

			var subMenu2Item = subMenu2.Item;
			subMenu2Item.SetIcon (Resource.Drawable.ic_compose);

			return base.OnCreateOptionsMenu (menu);
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:22,代码来源:SubMenus.cs

示例3: OnCreateOptionsMenu

        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            // Put overlay items first
            _mapView.OverlayManager.OnCreateOptionsMenu(menu, MenuLastId, _mapView);

            // Put samples next
            var samplesSubMenu = menu.AddSubMenu(0, MenuSamples, Menu.None, Resource.String.samples)
                .SetIcon(Android.Resource.Drawable.IcMenuGallery);
            var sampleFactory = SampleFactory.GetInstance();
            for (var a = 0; a < sampleFactory.Count(); a++)
            {
                var f = sampleFactory.GetSample(a);
                samplesSubMenu.Add(f.GetSampleTitle()).SetOnMenuItemClickListener(new StartSampleFragment(this, f));
            }

            // Put "About" menu item last
            menu.Add(0, MenuAbout, (int) MenuCategory.Secondary, Resource.String.about)
                .SetIcon(Android.Resource.Drawable.IcMenuInfoDetails);

            base.OnCreateOptionsMenu(menu, inflater);
        }
开发者ID:JohnPilczak,项目名称:OsmdroidXamarin,代码行数:21,代码来源:MapFragment.cs

示例4: ApplyInternal

        private void ApplyInternal(IMenu menu, Context context, int id, int order, object dataContext, bool useContext)
        {
            PlatformExtensions.ValidateTemplate(ItemsSource, Items);
            bool isSubMenu = !string.IsNullOrEmpty(ItemsSource) || (Items != null && Items.Count > 0);
            XmlPropertySetter<MenuItemTemplate, IMenuItem> setter;
            int groupId;
            int.TryParse(Group, out groupId);
            if (isSubMenu)
            {
                ISubMenu subMenu = menu.AddSubMenu(groupId, id, order, string.Empty);
                setter = new XmlPropertySetter<MenuItemTemplate, IMenuItem>(subMenu.Item, context, new BindingSet());
                subMenu.SetBindingMemberValue(AttachedMembers.Object.Parent, menu);
                subMenu.Item.SetBindingMemberValue(AttachedMembers.Object.Parent, subMenu);
                SetDataContext(subMenu, setter.BindingSet, dataContext, useContext);
                ApplySelf(subMenu.Item, setter);

                if (string.IsNullOrEmpty(ItemsSource))
                {
                    for (int index = 0; index < Items.Count; index++)
                        Items[index].Apply(subMenu, context, index, index);
                }
                else
                {
                    subMenu.SetBindingMemberValue(AttachedMembers.Menu.ItemsSourceGenerator,
                        new MenuItemsSourceGenerator(subMenu, context, ItemTemplate ?? this));
                    XmlPropertySetter<object, object>.AddBinding(setter.BindingSet, subMenu, AttachedMemberConstants.ItemsSource, ItemsSource, true);
                }
            }
            else
            {
                var menuItem = menu.Add(groupId, id, order, string.Empty);
                setter = new XmlPropertySetter<MenuItemTemplate, IMenuItem>(menuItem, context, new BindingSet());
                menuItem.SetBindingMemberValue(AttachedMembers.Object.Parent, menu);
                SetDataContext(menuItem, setter.BindingSet, dataContext, useContext);
                ApplySelf(menuItem, setter);
            }
            setter.Apply();
        }
开发者ID:sami1971,项目名称:MugenMvvmToolkit,代码行数:38,代码来源:MenuItemTemplate.cs

示例5: OnCreateOptionsMenu

        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            base.OnCreateOptionsMenu(menu);

            int groupId = 0;

            //Unique menu item identifier. used for event handling.
            int menuItemId = Menu.First;
            //The order position of the item
            int menuItemOrder = Menu.None;
            //Text to be displayed for this menu item
            int menuItemText = Resource.String.hello;

            //Create the menu item and keep a referance to it
            IMenuItem menuItem1 = menu.Add(
                groupId, 
                menuItemId, 
                menuItemOrder, 
                menuItemText);
            menuItem1.SetShortcut('1', 'a');

            int MenuGroup = 10;
            IMenuItem menuItem2 = menu.Add(
                MenuGroup, 
                menuItemId + 10, 
                menuItemOrder + 1, 
                new Java.Lang.String("Menu Item 2"));

            IMenuItem menuItem3 =
                menu.Add(
                    MenuGroup, 
                    menuItemId + 20, 
                    menuItemOrder + 2,
                    new Java.Lang.String("Menu Item 3")
                );

            ISubMenu sub = menu.AddSubMenu(
                0, 
                menuItemOrder + 30,
                menuItemOrder + 3, 
                new Java.Lang.String("Submenu 1")
            );

            sub.SetHeaderIcon(Resource.Drawable.Icon);
            sub.SetIcon(Resource.Drawable.Icon);

            IMenuItem submenuItem = sub.Add(
                0, 
                menuItemId + 40, 
                menuItemOrder + 4,
                new Java.Lang.String("Submenu Item")
            );

            IMenuItem submenuItem2 = 
                sub.Add(
                    MenuGroup, 
                    menuItemId + 50, 
                    menuItemOrder + 5,
                    new Java.Lang.String("sub-1")).SetCheckable(true);

            IMenuItem submenuItem3 =
                sub.Add(
                    MenuGroup, 
                    menuItemId + 60, 
                    menuItemOrder + 6,
                    new Java.Lang.String("sub-2")).SetCheckable(true);
            return true;
        }
开发者ID:caodaiming,项目名称:Gamodo.Droid.Examples,代码行数:68,代码来源:MainActivity.cs


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