コード例 #1
0
ファイル: AppShell.xaml.cs プロジェクト: ychaim/NxtWallet
        /// <summary>
        /// Initializes a new instance of the AppShell, sets the static 'Current' reference,
        /// adds callbacks for Back requests and changes in the SplitView's DisplayMode, and
        /// provide the nav menu list with the data to display.
        /// </summary>
        public AppShell(IWalletRepository walletRepository)
        {
            InitializeComponent();
            _walletRepository = walletRepository;

            _navlist = BuildNavigationList();

            Loaded += (sender, args) =>
            {
                Current = this;
                TogglePaneButton.Focus(FocusState.Programmatic);
            };

            RootSplitView.RegisterPropertyChangedCallback(
                SplitView.DisplayModeProperty,
                (s, a) =>
            {
                // Ensure that we update the reported size of the TogglePaneButton when the SplitView's
                // DisplayMode changes.
                CheckTogglePaneButtonSizeChanged();
            });

            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;

            NavMenuList.ItemsSource = _navlist;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the AppShell, sets the static 'Current' reference,
        /// adds callbacks for Back requests and changes in the SplitView's DisplayMode, and
        /// provide the nav menu list with the data to display.
        /// </summary>
        /// <param name="frame">The root frame of the application.</param>
        /// <param name="navigationItems">The navigation items.</param>
        /// <param name="bottomDockedNavigationItems">The optional navigation items that are docked at the bottom.</param>
        public AppShell(Frame frame, IEnumerable <NavMenuItem> navigationItems, IEnumerable <NavMenuItem> bottomDockedNavigationItems = null)
        {
            InitializeComponent();
            RootSplitView.Content = frame;
            _rootFrame            = frame;

            _rootFrame.Navigated += OnNavigatedToPage;

            Loaded += (sender, args) =>
            {
                Current = this;

                SelectNavigationItem(NavigationService.CurrentPageType);

                TogglePaneButton.Focus(FocusState.Programmatic);
            };

            SizeChanged += (s, e) =>
            {
                // update the button size when the frame size changes, due to possible changes of the adaptive UI
                CheckTogglePaneButtonSizeChanged();
            };

            if (navigationItems == null || navigationItems.Count() == 0)
            {
                throw new ArgumentException("There must be at least one top-level navigation item. Did you forgot to override a method in UniversalApp?");
            }

            NavigationItems         = new List <NavMenuItem>(navigationItems);
            NavMenuList.ItemsSource = navigationItems;

            if (bottomDockedNavigationItems != null && bottomDockedNavigationItems.Count() > 0)
            {
                NavMenuListBottomDock.ItemsSource = bottomDockedNavigationItems;

                foreach (var item in bottomDockedNavigationItems)
                {
                    NavigationItems.Add(item);
                }
            }
            else
            {
                NavMenuSeperator.Visibility = Visibility.Collapsed;
            }
        }
コード例 #3
0
        /// <summary>
        ///     Initializes a new instance of the AppShell, sets the static 'Current' reference,
        ///     adds callbacks for Back requests and changes in the SplitView's DisplayMode, and
        ///     provide the nav menu list with the data to display.
        /// </summary>
        public AppShell()
        {
            InitializeComponent();

            Loaded += (sender, args) => {
                Current = this;

                TogglePaneButton.Focus(FocusState.Programmatic);
            };

            var currentView = SystemNavigationManager.GetForCurrentView();

            currentView.BackRequested    += SystemNavigationManager_BackRequested;
            NavMenuListTop.ItemsSource    = navlistTop;
            NavMenuListBottom.ItemsSource = navlistBottom;
            //start with the "accounts" navigation button selected
            NavMenuListTop.SelectedIndex = 0;
            //start with a hidden back button. This changes when you navigate to an other page
            currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
        }