private void RetrivePrivateListViews(HamburgerMenu menu) { var topListField = (typeof(HamburgerMenu)).GetField("_buttonsListView", BindingFlags.Instance | BindingFlags.NonPublic); var topFieldValue = topListField.GetValue(menu); MenuPrivateTopListView = topListField.GetValue(menu) as ListViewBase; var bottomListField = (typeof(HamburgerMenu)).GetField("_optionsListView", BindingFlags.Instance | BindingFlags.NonPublic); MenuPrivateBottomListView = bottomListField.GetValue(menu) as ListViewBase; }
private void Expander_Expanded(object sender, EventArgs e) { var expanders = HamburgerMenu.FindDescendants <Expander>(); foreach (var expander in expanders) { if (expander != sender) { expander.IsExpanded = false; } } }
private void ConnectToSearch() { var searchButton = HamburgerMenu.FindDescendantByName("SearchButton") as Button; _searchBox = HamburgerMenu.FindDescendantByName("SearchBox") as AutoSuggestBox; if (_searchBox == null || searchButton == null) { return; } searchButton.Click += async(sender, args) => { HamburgerMenu.IsPaneOpen = true; _searchBox.Text = string.Empty; // We need to wait for the textbox to be created to focus it (only first time). TextBox innerTextbox = null; do { innerTextbox = _searchBox.FindDescendant <TextBox>(); innerTextbox?.Focus(FocusState.Programmatic); if (innerTextbox == null) { await Task.Delay(150); } }while (innerTextbox == null); }; _searchBox.DisplayMemberPath = "Name"; _searchBox.TextMemberPath = "Name"; _searchBox.QuerySubmitted += (sender, args) => { NavigationFrame.Navigate(typeof(SamplePicker), _searchBox.Text); }; _searchBox.TextChanged += (sender, args) => { if (args.Reason != AutoSuggestionBoxTextChangeReason.UserInput) { return; } UpdateSearchSuggestions(); }; }
/// <summary> /// メニュー選択時メソッド /// </summary> /// <param name="sender"></param> private void selectItem(object sender) { HamburgerMenu menu = sender as HamburgerMenu; HamburgerMenuImageItem imageItem = (HamburgerMenuImageItem)menu.Items[menu.SelectedIndex]; string selectedChannelId = model.FindChannelId(imageItem.Label); VideoListItems.Clear(); Task.Run(async() => { IsVideoListProgressActive = true; await CreateVideoListAsync(selectedChannelId); IsVideoListProgressActive = false; }); }
public Shell() { Instance = this; InitializeComponent(); Loaded += Shell_Loaded; ViewModel = App.Current.Kernel.Resolve <PlayerBarViewModel>(); AppSettings = App.Current.Kernel.Resolve <IAppSettingsUtility>(); RequestedTheme = (ElementTheme)AppSettings.Theme; HamburgerMenu.RefreshStyles((ElementTheme)AppSettings.Theme); AppSettings.PropertyChanged += (sender, args) => { if (args.PropertyName == nameof(AppSettings.Theme)) { RequestedTheme = (ElementTheme)AppSettings.Theme; HamburgerMenu.RefreshStyles((ElementTheme)AppSettings.Theme); } }; }
private void AddMenuItems() { HamburgerMenu.Add(new MasterMenuItem() { Title = "Opret barn", Icon = "addChild.png", TargetPage = "AddChildPage" }); HamburgerMenu.Add(new MasterMenuItem() { Title = "Indstillinger", Icon = "settings.png", TargetPage = "SettingsPage" }); HamburgerMenu.Add(new MasterMenuItem() { Title = "Historik", Icon = "historik.png", TargetPage = "HistorikPage" }); HamburgerMenu.Add(new MasterMenuItem() { Title = "Logud", Icon = "logud.png", TargetPage = "MainPage" }); }
private void HamburgerMenu_OnOptionsItemClick(object sender, ItemClickEventArgs e) { var option = e.ClickedItem as Option; if (option == null) { return; } if (NavigationFrame.CurrentSourcePageType != option.PageType) { NavigationFrame.Navigate(option.PageType); } HamburgerMenu.IsPaneOpen = false; var expanders = HamburgerMenu.FindDescendants <Expander>(); foreach (var expander in expanders) { expander.IsExpanded = false; } }
/// <summary> /// Returns a list of submenu buttons with the same GroupName attribute as the command button upon which this /// extension is invoked (which is treated as Parent command button). /// </summary> /// <returns>Submenu buttons in List<HamburgerButtonInfo>. If no submenu buttons found, List is still returned with element count of 0. </returns> /// <remarks> /// For added convenience, the GroupName attribute is detected with string.StartWith(groupName) rather than /// the straightforward string.Equals(groupName). That way we can tag submenu buttons as groupName1, groupName2, /// groupName3, etc. With this scheme, the parent command button should be named by subset string, /// which in this case is groupName. /// You don't have to use this scheme in which case you just stick to a single groupName for all buttons. /// </remarks> public static List <HamburgerButtonInfo> ItemsInGroup(this HamburgerButtonInfo button, bool IncludeSecondaryButtons = false) { string groupName = button.GroupName?.ToString(); // Return 0 count List rather than null if (string.IsNullOrWhiteSpace(groupName)) { return(new List <HamburgerButtonInfo>()); } FrameworkElement fe = button.Content as FrameworkElement; HamburgerMenu hamMenu = fe.FirstAncestor <HamburgerMenu>(); List <HamburgerButtonInfo> NavButtons = hamMenu.PrimaryButtons.ToList(); if (IncludeSecondaryButtons) { NavButtons.InsertRange(NavButtons.Count, hamMenu.SecondaryButtons.ToList()); } List <HamburgerButtonInfo> groupItems = NavButtons.Where(x => !x.Equals(button) && (x.GroupName?.ToString()?.StartsWith(groupName) ?? false)).ToList(); return(groupItems); }
public Shell() { InitializeComponent(); Instance = this; HamMen = new HamburgerMenu(); if (StoreServicesFeedbackLauncher.IsSupported()) { FeedbackButton.Visibility = Visibility.Visible; } CustomSettings.UserLogChanged -= CustomSettings_IsUserLoggedChanged; CustomSettings.UserLogChanged += CustomSettings_IsUserLoggedChanged; CustomSettings.ShowAdsChanged -= CustomSettings_ShowAdsChanged; CustomSettings.ShowAdsChanged += CustomSettings_ShowAdsChanged; SettingsPartViewModel.HelloSecurityChanged -= SettingsPartViewModel_HelloSecurityChanged; SettingsPartViewModel.HelloSecurityChanged += SettingsPartViewModel_HelloSecurityChanged; AccountsSettingsPane.GetForCurrentView().AccountCommandsRequested -= BuildLoginPaneAsync; AccountsSettingsPane.GetForCurrentView().AccountCommandsRequested += BuildLoginPaneAsync; CoreApplicationViewTitleBar titleBar = CoreApplication.GetCurrentView().TitleBar; titleBar.LayoutMetricsChanged -= TitleBar_LayoutMetricsChanged; titleBar.LayoutMetricsChanged += TitleBar_LayoutMetricsChanged; LoggingButton.IsEnabled = SettingsService.Instance.UseHelloSecurity && KeyCredentialManager.IsSupportedAsync().AsTask().Result; uiSettings.ColorValuesChanged += ThemeChanger; NavView.ShowAd = Visibility.Collapsed; }
public Task StartSearch(string startingText = "") { return(HamburgerMenu.StartSearch(startingText)); }
private void UpdateMargin(HamburgerMenu ham) { var value = (ham.IsOpen) ? ham.PaneWidth : 48d; BottomAppBar.Margin = new Thickness(value, 0, 0, 0); }
/// <summary> /// In HTML konvertieren /// </summary> /// <returns>Das Control als HTML</returns> public override IHtmlNode ToHtml() { var classes = new List <string>(); classes.Add(Class); classes.Add("navbar"); //classes.Add("navbar-expand-xl"); if (Dark) { classes.Add("navbar-dark"); } else { classes.Add("navbar-light"); } switch (Fixed) { case FixedTypes.Top: classes.Add("fixed-top"); break; case FixedTypes.Bottom: classes.Add("fixed-bottom"); break; } switch (Expand) { case ExpandTypes.ExtraLarge: classes.Add("navbar-expand-xl"); break; case ExpandTypes.Large: classes.Add("navbar-expand-lg"); break; case ExpandTypes.Medium: classes.Add("navbar-expand-md"); break; case ExpandTypes.Small: classes.Add("navbar-expand-sm"); break; } if (Sticky) { classes.Add("sticky-top"); } var html = new HtmlElementNav() { Class = string.Join(" ", classes.Where(x => !string.IsNullOrWhiteSpace(x))) }; html.Elements.Add(HamburgerMenu.ToHtml()); html.Elements.Add(ToolBar.ToHtml()); html.Elements.Add(new HtmlElementSpan(new HtmlText(Title)) { Class = "navbar-text" }); html.Elements.Add(NotificationBar.ToHtml()); return(html); }
public App() { InitializeComponent(); MainPage = new HamburgerMenu(); }
public void SetHamburgerMenuElement(HamburgerMenu hamburgerMenu) { _hamburgerMenu = hamburgerMenu; }