예제 #1
0
		private void ShowFlyoutMenu(object sender, RoutedEventArgs e)
		{
			Flyout f = new Flyout();
			f.PlacementTarget = sender as UIElement;
			f.Placement = PlacementMode.Top;
			f.Closed += (x, y) =>
			{
				LogEvent("Event: Closed");
			};

			Menu menu = new Menu();

			MenuItem mi = new MenuItem();
			mi.Tag = "Easy";
			mi.Tapped += ItemClicked;
			mi.Text = "Easy Game";
            mi.MenuTextMargin = new Thickness(28, 10, 28, 12);

			MenuItem mi2 = new MenuItem();
			mi2.Text = "Medium Game";
			mi2.Tag = "Medium";
			mi2.Tapped += ItemClicked;
            mi2.MenuTextMargin = new Thickness(28, 10, 28, 12);

			MenuItem mi3 = new MenuItem();
			mi3.Text = "Hard Game";
			mi3.Command = new CommandTest();
			mi3.CommandParameter = "test param from command";
            mi3.MenuTextMargin = new Thickness(28, 10, 28, 12);

            ToggleMenuItem tmi = new ToggleMenuItem();
            tmi.Text = "Enable Logging";
            tmi.IsChecked = chk;
            tmi.Tapped += (a, b) =>
                {
                    chk = !chk;
                };

			menu.Items.Add(mi);
			menu.Items.Add(mi2);
			menu.Items.Add(new MenuItemSeparator());
			menu.Items.Add(new MenuItem() { Text = "Foobar something really long", Tag = "Long menu option", MenuTextMargin = new Thickness(28,10,28,12) });
            menu.Items.Add(tmi);
			menu.Items.Add(new MenuItemSeparator());
			menu.Items.Add(mi3);
            f.HostMargin = new Thickness(0); // on menu flyouts set HostMargin to 0
			f.Content = menu;
			f.IsOpen = true;

			ObjectTracker.Track(f);

			UpdateLayout();
		}
예제 #2
0
        private void FilterButton_Click(object sender, RoutedEventArgs e)
        {
            DataTransferManager.GetForCurrentView().DataRequested -= new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested);
            Flyout flyout = new Flyout();
            flyout.PlacementTarget = sender as UIElement;
            flyout.Placement = PlacementMode.Top;
            flyout.HostMargin = new Thickness(0);

            Menu menu = new Menu();

            ToggleMenuItem filterByTag_menuItem = new ToggleMenuItem();
            filterByTag_menuItem.Text = "by Tag";
            filterByTag_menuItem.Command = new NavigateToFilterTypeCommand(sender, "tag");
            menu.Items.Add(filterByTag_menuItem);

            ToggleMenuItem filterByCategory_menuItem = new ToggleMenuItem();
            filterByCategory_menuItem.Text = "by Category";
            filterByCategory_menuItem.Command = new NavigateToFilterTypeCommand(sender, "category");
            menu.Items.Add(filterByCategory_menuItem);

            menu.MaxHeight = 300;

            flyout.Content = menu;
            flyout.IsOpen = true;

            UpdateLayout();
        }
예제 #3
0
        private void ShowFlyoutToggleMenu(object sender, RoutedEventArgs e)
        {
            Flyout f = new Flyout();
            f.PlacementTarget = sender as UIElement;
            f.Placement = PlacementMode.Top;
            f.Closed += (x, y) =>
            {
                LogEvent("Event: Closed");
            };

            Menu menu = new Menu();


            ToggleMenuItem tmi1 = new ToggleMenuItem();
            tmi1.Text = "Enable Logging";
            tmi1.IsChecked = chk;
            tmi1.Tapped += (a, b) =>
            {
                chk = !chk;
            };

            ToggleMenuItem tmi2 = new ToggleMenuItem();
            tmi2.Text = "Disable Logging";
            tmi2.IsChecked = !chk;
            tmi2.Tapped += (a, b) =>
            {
                chk = !chk;
            };

            menu.Items.Add(tmi1);
            menu.Items.Add(tmi2);
            f.HostMargin = new Thickness(0); // on menu flyouts set HostMargin to 0
            f.Content = menu;
            f.IsOpen = true;

            ObjectTracker.Track(f);

            UpdateLayout();
        }
예제 #4
0
            public async void Execute(object param)
            {
                FeedDataSource feedDataSource = (FeedDataSource)App.Current.Resources["feedDataSource"];
                if (feedDataSource == null)
                {
                    return;
                }
            
                //Shouldn't need this now, but I'll leave it here
                ProgressRing filter_ring = new ProgressRing();
                filter_ring.IsActive = true;
                Flyout flyout = new Flyout();
                flyout.PlacementTarget = sender as UIElement;
                flyout.Placement = PlacementMode.Top;
                flyout.HostMargin = new Thickness(0);
                Border b = new Border();
                b.Width = 20;
                b.Height = 20;
                b.Child = filter_ring;
                flyout.Content = b;
                flyout.IsOpen = true;

                Menu menu = new Menu();
                menu.MaxHeight = 300;

                switch (type)
                {
                    case "category":
                        foreach (Category item in feedDataSource.CategoryList.categories)
                            {
                                ToggleMenuItem menuItem = new ToggleMenuItem();
                                menuItem.Text = item.title;
                                menuItem.Command = new MenuCategoryCommand(item.slug, item.title);
                                menu.Items.Add(menuItem);
                            }
                        break;

                    case "tag":
                    default:
                        foreach (Tag item in feedDataSource.TagList.tags)
                        {
                            ToggleMenuItem menuItem = new ToggleMenuItem();
                            menuItem.Text = item.title;
                            menuItem.Command = new MenuTagCommand(item.slug, item.title);
                            menu.Items.Add(menuItem);
                        }
                        break;
                }

                flyout.Content = menu;
            }