public MainMasterDetailPage() { FlyoutMenuViewModel flyoutMenu = new FlyoutMenuViewModel(); _flyMenu = new FlyoutMenu(flyoutMenu); _flyMenu.Menu.ItemSelected += handleOnMenuItemSelected; Master = _flyMenu; NavigateTo(flyoutMenu.FlyoutMenuItems[0]); }
private void MainMenuControl_HideMenu(object sender, EventArgs e) { FlyoutMenu.Hide(); var type = sender as Type; if (type == null || type == typeof(BudgetPage)) { return; } Frame.Navigate(type); }
public ShellApplication() { RootPage.Instance.DeviceBackButtonPressed += OnDeviceBackButtonPressed; // Create popup layout for popups Popup.PopupLayout = new PopupLayout(); _flyoutMenu = new FlyoutMenu(); _flyoutMenu.IsMainMenuOpenChanging += (object sender, bool isOpen) => { IsMainMenuOpen = isOpen; IsMainMenuOpenChanging?.Invoke(sender, isOpen); }; _flyoutMenu.IsMainMenuOpenChanged += (object sender, bool isOpen) => { IsMainMenuOpenChanged?.Invoke(sender, isOpen); }; _flyoutMenu.IsSubMenuOpenChanged += (object sender, bool isOpen) => { IsSubMenuOpenChanged?.Invoke(sender, isOpen); }; _flyoutMenu.IsSubMenuOpenChanging += (object sender, bool isOpen) => { IsSubMenuOpen = isOpen; IsSubMenuOpenChanging?.Invoke(sender, isOpen); }; // Content _navigationPage = new NavigationPage(); _flyoutMenu.Content = _navigationPage; _navigationPage.MenuButtonTapped += (s, a) => { _flyoutMenu.IsMainMenuOpen = true; }; // MainMenu _mainMenuNavigationPage = new NavigationPage(); _mainMenuNavigationPage.HasPagesChanged += (object s, bool hasPages) => { if (hasPages) { _flyoutMenu.MainMenu = _mainMenuNavigationPage; } else { _flyoutMenu.MainMenu = null; } }; // SubMenu _subMenuNavigationPage = new NavigationPage(); _subMenuNavigationPage.HasPagesChanged += (object s, bool hasPages) => { if (hasPages) { _flyoutMenu.SubMenu = _subMenuNavigationPage; } else { _flyoutMenu.SubMenu = null; } }; // Modal _modalNavigationPage = new NavigationPage(); _modalNavigationPage.IsVisible = false; _modalNavigationPage.HasPagesChanged += (object s, bool hasPages) => { _modalNavigationPage.IsVisible = hasPages; }; // Titlebar _titleBarSeparator = new BoxView(); _titleBarSeparator.VerticalOptions = LayoutOptions.Start; _titleBarSeparator.HeightRequest = TitleBarSeparatorThickness; _titleBarSeparator.BackgroundColor = TitleBarSeparatorColor; // Add navigation page and popup layout to root page content StackLayout m_rootLayout = new StackLayout(); m_rootLayout.Orientation = StackOrientations.Depth; m_rootLayout.Children.Add(_flyoutMenu); m_rootLayout.Children.Add(_modalNavigationPage); m_rootLayout.Children.Add(Popup.PopupLayout); m_rootLayout.Children.Add(_titleBarSeparator); // Add to content RootPage.Instance.Content = m_rootLayout; MainPage = RootPage.Instance; }
private void Bubble_Holding(object sender, HoldingRoutedEventArgs e) { FrameworkElement senderElement = sender as FrameworkElement; FlyoutMenu.ShowAt(senderElement); }
// show a flyout menu under under the pointer private void ShowFlyOutMenu(object sender, RightTappedRoutedEventArgs e) { FlyoutMenu.ShowAt(sender as UIElement, e.GetPosition(sender as UIElement)); }
// flyout menu on right click private void DevicesGridView_RightTapped(object sender, RightTappedRoutedEventArgs e) { FlyoutMenu.ShowAt(sender as UIElement, e.GetPosition(sender as UIElement)); }
private void MainMenuControl_ShowAlarm(object sender, EventArgs e) { FlyoutMenu.Hide(); Frame.Navigate(typeof(MainPage)); }
private void MainMenuControl_ShowAlarm(object sender, EventArgs e) { FlyoutMenu.Hide(); AlarmLine.Visibility = Visibility.Visible; }