コード例 #1
0
        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();
                }
            };
        }
コード例 #2
0
ファイル: NavMenuListView.cs プロジェクト: XZiar/WordsLinks
        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();
                }
            };
        }
コード例 #3
0
        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();
                    });
                }

            };
        }
コード例 #4
0
        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();
                }
            };
        }
コード例 #5
0
ファイル: NavMenuListView.cs プロジェクト: GauravGarg118/11
        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();
                }
            };
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        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();
                }
            };
        }
コード例 #8
0
        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();
        }
コード例 #9
0
        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);
            }
        }
コード例 #10
0
ファイル: NavMenuListView.cs プロジェクト: JTechMe/MBoard-UWP
        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();
        }
コード例 #11
0
        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();
            }
        }
コード例 #12
0
        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();
                }
            };
        }
コード例 #13
0
        public HomeView()
        {
            InitializeComponent();

            SplitView.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, IsPaneOpenPropertyChanged);
        }
コード例 #14
0
        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();
            }
        }