/// <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 ShellView(Frame frame) { _currentFrame = frame; this.InitializeComponent(); var transition = new NavigationThemeTransition(); frame.ContentTransitions=new TransitionCollection(); frame.ContentTransitions.Add(transition); SetTitleBarColor(); _currentFrame.Navigated += _currentFrame_Navigated; Grid.SetRow(_currentFrame,1); this.RootContent.Children.Add(frame); this.Loaded += (sender, args) => { this.DataContext = Mvx.Resolve<ShellViewModel>(); NavMenuList.ItemsSource = (this.DataContext as ShellViewModel).Menu; Current = this; this.TogglePaneButton.Focus(FocusState.Programmatic); }; SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested; // If on a phone device that has hardware buttons then we hide the app's back button. if (ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { this.BackButton.Visibility = Visibility.Collapsed; } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { this.shell = Window.Current.Content as ShellView; Frame rootFrame = null; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); // Set the default language rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter var setup = new Setup(rootFrame); setup.Initialize(); var start = Mvx.Resolve<IMvxAppStart>(); start.Start(); } if (this.shell == null) { // create new shell this.shell = new ShellView(rootFrame); } // Place the shell with frame as content in the current Window Window.Current.Content = shell; // Ensure the current window is active Window.Current.Activate(); }
private void Current_TogglePaneButtonSizeChanged(ShellView sender, Rect e) { this.titleBar.Margin = new Thickness(e.Right, 0, 0, 0); }