private Frame GetRootFrame()
        {
            Frame rootFrame;

            if (!(Window.Current.Content is App_Root rootPage))
            {
                rootPage  = new App_Root();
                rootFrame = (Frame)rootPage.FindName("rootFrame");
                if (rootFrame == null)
                {
                    throw new Exception("Root frame not found");
                }
                rootFrame.Language          = Windows.Globalization.ApplicationLanguages.Languages[0];
                rootFrame.NavigationFailed += OnNavigationFailed;

                Window.Current.Content = rootPage;
            }
Example #2
0
        public App_Root()
        {
            this.InitializeComponent();


            Current = this;
            MasterFrame.Navigate(typeof(My_Calendar));
            NavViewControl.Header = "My Calendar";

            CoreApplication.GetCurrentView().TitleBar.LayoutMetricsChanged += (s, e) => UpdateAppTitle(s);

            void UpdateAppTitle(CoreApplicationViewTitleBar coreTitleBar)
            {
                var full = (ApplicationView.GetForCurrentView().IsFullScreenMode);
                var left = 12 + (full ? 0 : coreTitleBar.SystemOverlayLeftInset);

                AppTitle.Margin    = new Thickness(left, 8, 0, 0);
                AppTitleBar.Height = coreTitleBar.Height;
            }

            // Add keyboard accelerators for backwards navigation.
            KeyboardAccelerator GoBack = new KeyboardAccelerator
            {
                Key = VirtualKey.GoBack
            };
            KeyboardAccelerator AltLeft = new KeyboardAccelerator
            {
                Key = VirtualKey.Left
            };

            this.KeyboardAccelerators.Add(GoBack);
            this.KeyboardAccelerators.Add(AltLeft);
            // ALT routes here
            AltLeft.Modifiers = VirtualKeyModifiers.Menu;

            _isKeyboardConnected = Convert.ToBoolean(new KeyboardCapabilities().KeyboardPresent);
        }