Exemplo n.º 1
0
        private void MoveContentUnderTopnavTitleBar_Click(object sender, RoutedEventArgs e)
        {
            var topNavArea   = FindVisualChildByName(NavView, "TopNavArea") as FrameworkElement;
            var topNavGrid   = FindVisualChildByName(NavView, "TopNavGrid") as FrameworkElement;
            var topNavHeight = topNavGrid.Height + 33;

            var testFrame = WindowEx.Current.Content as TestFrame;

            if (TitleBar.GetExtendViewIntoTitleBar(Application.Current.MainWindow))
            {
                //AppTitleBar
                testFrame.ChangeBarVisibility(Visibility.Visible);
                TitleBar.SetExtendViewIntoTitleBar(Application.Current.MainWindow, false);

                // Reset values
                Grid.SetRow(topNavArea, 0);
                ContentScrollViewer.Height  = double.NaN;
                ContentStackPanel.Margin    = new Thickness(0);
                ContentScrollViewer.Margin  = new Thickness(0);
                ContentScrollViewer.Padding = new Thickness(0);
            }
            else
            {
                //AppTitleBar
                testFrame.ChangeBarVisibility(Visibility.Collapsed);
                TitleBar.SetExtendViewIntoTitleBar(Application.Current.MainWindow, true);

                Grid.SetRow(topNavArea, 1);
                ContentScrollViewer.Height  = 200;
                ContentStackPanel.Margin    = new Thickness(0, topNavHeight, 0, 0);
                ContentScrollViewer.Margin  = new Thickness(0, topNavHeight, 0, 0);
                ContentScrollViewer.Padding = new Thickness(0, -topNavHeight, 0, 0);
            }
        }
Exemplo n.º 2
0
        private void UpdateTitleBar()
        {
            bool useCustomTitleBar = TitleBar.GetExtendViewIntoTitleBar(this);

            if (useCustomTitleBar)
            {
                CustomTitleBar.Visibility = Visibility.Visible;
                TitleBar.SetBackButtonStyle(this, (Style)Resources["CustomTitleBarBackButtonStyle"]);
                TitleBar.SetButtonStyle(this, (Style)Resources["CustomTitleBarButtonStyle"]);
                TitleBar.SetIsBackButtonVisible(this, true);
            }
            else
            {
                CustomTitleBar.Visibility = Visibility.Collapsed;
                ClearValue(TitleBar.BackButtonStyleProperty);
                ClearValue(TitleBar.ButtonStyleProperty);
                SetBinding(TitleBar.IsBackButtonVisibleProperty, new Binding("CanGoBack")
                {
                    Source = RootFrame
                });
            }
        }