public NavMenuListView() { this.SelectionMode = ListViewSelectionMode.Single; this.SingleSelectionFollowsFocus = false; this.IsItemClickEnabled = true; this.ItemClick += ItemClickedHandler; // Locate the hosting SplitView control this.Loaded += (s, a) => { var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is SplitView)) { parent = VisualTreeHelper.GetParent(parent); } if (parent != null) { this.splitViewHost = parent as SplitView; splitViewHost.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, (sender, args) => { this.OnPaneToggled(); }); splitViewHost.RegisterPropertyChangedCallback(SplitView.DisplayModeProperty, (sender, args) => { this.OnPaneToggled(); }); // Call once to ensure we're in the correct state this.OnPaneToggled(); } }; }
public NavMenuListView() { SelectionMode = ListViewSelectionMode.Single; SingleSelectionFollowsFocus = false; IsItemClickEnabled = true; ItemClick += (o, e) => OnItemClicked(e.ClickedItem as NavPageItem); // Locate the hosting SplitView control Loaded += (s, a) => { var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is SplitView)) parent = VisualTreeHelper.GetParent(parent); if (parent != null) { host = parent as SplitView; host.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, (sender, args) => { OnPaneToggled(); }); host.RegisterPropertyChangedCallback(SplitView.DisplayModeProperty, (sender, args) => { OnPaneToggled(); }); // Call once to ensure we're in the correct state OnPaneToggled(); } }; }
public NavigationMenuListView() { this.SelectionMode = ListViewSelectionMode.Single; this.IsItemClickEnabled = true; this.ItemClick += ItemClickedHandler; this.Loaded += (s, a) => { var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is SplitView)) { parent = VisualTreeHelper.GetParent(parent); } if (parent != null) { this._parentSplitView = parent as SplitView; _parentSplitView.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, (sender, args) => { this.OnPaneToggled(); }); } }; }
public NavMenuListView() { this.SelectionMode = ListViewSelectionMode.Single; this.IsItemClickEnabled = true; this.ItemClick += ItemClickedHandler; // Locate the hosting SplitView control this.Loaded += (s, a) => { var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is SplitView)) { parent = VisualTreeHelper.GetParent(parent); } if (parent != null) { this.splitViewHost = parent as SplitView; splitViewHost.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, (sender, args) => { this.OnPaneToggled(); }); // Call once to ensure we're in the correct state this.OnPaneToggled(); } }; }
public NavMenuListView() { SelectionMode = ListViewSelectionMode.Single; // This API doesn't exist on early versions of Windows 10, so check for it an only set it if it // exists on the version that the app is being run on. if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.ListViewBase", "SingleSelectionFollowsFocus")) { SingleSelectionFollowsFocus = false; } IsItemClickEnabled = true; ItemClick += ItemClickedHandler; // Locate the hosting SplitView control Loaded += (s, a) => { var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is SplitView)) { parent = VisualTreeHelper.GetParent(parent); } if (parent != null) { splitViewHost = parent as SplitView; splitViewHost.RegisterPropertyChangedCallback( SplitView.IsPaneOpenProperty, (sender, args) => { OnPaneToggled(); }); splitViewHost.RegisterPropertyChangedCallback( SplitView.DisplayModeProperty, (sender, args) => { OnPaneToggled(); }); // Call once to ensure we're in the correct state OnPaneToggled(); } }; }
private void Shell_Loaded(object sender, RoutedEventArgs e) { Window.Current.SetTitleBar(TitleBar); SplitView.RegisterPropertyChangedCallback(Windows.UI.Xaml.Controls.SplitView.DisplayModeProperty, SplitViewDisplayModeChanged); if (ContentFrame.SourcePageType != null) { UpdateSelectedIndex(ContentFrame.SourcePageType); } }
public MainMenuListView() { SelectionMode = ListViewSelectionMode.Single; SingleSelectionFollowsFocus = false; IsItemClickEnabled = true; ItemClick += OnItemClicked; Loaded += (s, a) => { var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is SplitView)) { parent = VisualTreeHelper.GetParent(parent); } if (parent != null && parent is SplitView sv) { splitView = sv; splitView.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, (sender, args) => OnPaneToggled()); splitView.RegisterPropertyChangedCallback(SplitView.DisplayModeProperty, (sender, args) => OnPaneToggled()); OnPaneToggled(); } }; }
private void OnLoaded(object o, RoutedEventArgs e) { var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is SplitView)) { parent = VisualTreeHelper.GetParent(parent); } if (parent == null) return; _splitViewHost = (SplitView) parent; _splitViewHost.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, (_, __) => { OnPaneToggled(); }); OnPaneToggled(); }
protected override void OnApplyTemplate() { TogglePaneButton = GetTemplateChild("TogglePaneButton") as Button; RootSplitView = GetTemplateChild("RootSplitView") as SplitView; TogglePaneButton.Click += Toggle_Click; if (ApiInformation.IsEventPresent("Windows.UI.Xaml.Controls.SplitView", "PaneOpening")) { RootSplitView.PaneOpening += OnPaneOpening; RootSplitView.PaneClosing += OnPaneClosing; } else { RootSplitView.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, OnPaneOpenChanged); } }
private void OnLoaded(object o, RoutedEventArgs e) { var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is SplitView)) { parent = VisualTreeHelper.GetParent(parent); } if (parent == null) { return; } _splitViewHost = (SplitView)parent; _splitViewHost.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, (_, __) => { OnPaneToggled(); }); OnPaneToggled(); }
private void NavMenuListView_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is Page) && !(parent is SplitView)) { parent = VisualTreeHelper.GetParent(parent); } if (parent != null && parent is SplitView) { this.splitViewHost = parent as SplitView; splitViewHost.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, (control, args) => { this.OnPaneToggled(); }); this.OnPaneToggled(); } }
public NavMenuListView() { SelectionMode = ListViewSelectionMode.Single; IsItemClickEnabled = true; ItemClick += ItemClickHandler; Loaded += (a, b) => { var p = VisualTreeHelper.GetParent(this); while (p != null && !(p is SplitView)) { p = VisualTreeHelper.GetParent(p); } if (p != null) { splitView = p as SplitView; splitView.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, (sender, args) => { OnPaneToggled(); }); OnPaneToggled(); } }; }
public HomeView() { InitializeComponent(); SplitView.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, IsPaneOpenPropertyChanged); }
void MenuListviewLoaded(object sender, RoutedEventArgs e) { var folder = Package.Current.InstalledLocation; var files = folder.GetFilesAsync().AsTask(); foreach (var file in files.Result) { if ((file.FileType != ".dll" && file.FileType != ".exe") || file.DisplayName.StartsWith("CLR", StringComparison.OrdinalIgnoreCase) || file.DisplayName.StartsWith("Microsoft", StringComparison.OrdinalIgnoreCase) || file.DisplayName.StartsWith("System", StringComparison.OrdinalIgnoreCase) || file.DisplayName.StartsWith("UCRT", StringComparison.OrdinalIgnoreCase)) continue; userAssemblies.Add(Assembly.Load(new AssemblyName(file.DisplayName))); } var parent = VisualTreeHelper.GetParent(this); while (parent != null && !(parent is SplitView)) parent = VisualTreeHelper.GetParent(parent); if (parent != null) { splitViewHost = parent as SplitView; splitViewHost.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, (s, a) => OnPaneToggled()); OnPaneToggled(); } }