mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Navigate with RootFrame instead
This commit is contained in:
parent
3ff418f096
commit
0873be2f6b
5 changed files with 22 additions and 35 deletions
|
@ -20,15 +20,21 @@
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<Grid x:Name="PageGrid" AutomationProperties.LandmarkType="Main">
|
<Grid x:Name="PageGrid" AutomationProperties.LandmarkType="Main">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="1*"
|
<RowDefinition Height="1*"
|
||||||
MinHeight="{StaticResource HamburgerHeight}"
|
MinHeight="{StaticResource HamburgerHeight}"
|
||||||
MaxHeight="52"/>
|
MaxHeight="52"/>
|
||||||
<RowDefinition Height="1*"/>
|
<RowDefinition Height="1*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<local:TitleBar/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid Height="{StaticResource HamburgerHeight}"
|
<Grid Height="{StaticResource HamburgerHeight}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Top">
|
VerticalAlignment="Top"
|
||||||
|
Grid.Row="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="{StaticResource HamburgerHeightGridLength}"/>
|
<ColumnDefinition Width="{StaticResource HamburgerHeightGridLength}"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
@ -37,6 +43,7 @@
|
||||||
<Button x:Name="BackButton"
|
<Button x:Name="BackButton"
|
||||||
x:Uid="BackButton"
|
x:Uid="BackButton"
|
||||||
Style="{StaticResource NavigationBackButtonNormalStyle}"
|
Style="{StaticResource NavigationBackButtonNormalStyle}"
|
||||||
|
Grid.Row="1"
|
||||||
Click="BackButtonClick"/>
|
Click="BackButtonClick"/>
|
||||||
|
|
||||||
<TextBlock x:Uid="SettingsHeader"
|
<TextBlock x:Uid="SettingsHeader"
|
||||||
|
@ -47,7 +54,7 @@
|
||||||
Style="{StaticResource CategoryNameTextBlockStyle}"/>
|
Style="{StaticResource CategoryNameTextBlockStyle}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<StackPanel Grid.Row="1" Margin="12,0,12,0">
|
<StackPanel Grid.Row="2" Margin="12,0,12,0">
|
||||||
<StackPanel x:Name="SettingsStack"
|
<StackPanel x:Name="SettingsStack"
|
||||||
AutomationProperties.LabeledBy="{Binding ElementName=SettingsAppTheme}"
|
AutomationProperties.LabeledBy="{Binding ElementName=SettingsAppTheme}"
|
||||||
Orientation="Vertical">
|
Orientation="Vertical">
|
||||||
|
|
|
@ -95,15 +95,6 @@ SettingsPage::SettingsPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsPage::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs ^ e)
|
|
||||||
{
|
|
||||||
MainPage ^ mainPage = dynamic_cast<MainPage ^> (e->Parameter);
|
|
||||||
if (mainPage != nullptr)
|
|
||||||
{
|
|
||||||
MainPageProperty = mainPage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsPage::SetDefaultFocus()
|
void SettingsPage::SetDefaultFocus()
|
||||||
{
|
{
|
||||||
SettingsLightTheme->Focus(::FocusState::Programmatic);
|
SettingsLightTheme->Focus(::FocusState::Programmatic);
|
||||||
|
@ -139,6 +130,8 @@ void SettingsPage::InitializeContributeTextBlock()
|
||||||
|
|
||||||
void SettingsPage::BackButtonClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
|
void SettingsPage::BackButtonClick(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
|
||||||
{
|
{
|
||||||
|
auto rootFrame = dynamic_cast<::Frame ^>(Window::Current->Content);
|
||||||
|
|
||||||
if (SettingsRestartApp->Visibility == ::Visibility::Visible)
|
if (SettingsRestartApp->Visibility == ::Visibility::Visible)
|
||||||
{
|
{
|
||||||
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"restartApp", L"True");
|
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"restartApp", L"True");
|
||||||
|
@ -147,7 +140,7 @@ void SettingsPage::BackButtonClick(Platform::Object ^ sender, Windows::UI::Xaml:
|
||||||
{
|
{
|
||||||
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"restartApp", L"False");
|
Windows::Storage::ApplicationData::Current->LocalSettings->Values->Insert(L"restartApp", L"False");
|
||||||
}
|
}
|
||||||
MainPageProperty->CollapseSettings();
|
rootFrame->Navigate((MainPage::typeid), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsPage::SetVersionString()
|
void SettingsPage::SetVersionString()
|
||||||
|
|
|
@ -15,9 +15,6 @@ namespace CalculatorApp
|
||||||
SettingsPage();
|
SettingsPage();
|
||||||
property MainPage ^ MainPageProperty;
|
property MainPage ^ MainPageProperty;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs ^ e) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetDefaultFocus();
|
void SetDefaultFocus();
|
||||||
void InitializeContributeTextBlock();
|
void InitializeContributeTextBlock();
|
||||||
|
|
|
@ -383,10 +383,8 @@ void MainPage::EnsureConverter()
|
||||||
|
|
||||||
void MainPage::EnsureSettings()
|
void MainPage::EnsureSettings()
|
||||||
{
|
{
|
||||||
SettingsHolder->Navigate((SettingsPage::typeid), this);
|
auto rootFrame = dynamic_cast<::Frame ^>(Window::Current->Content);
|
||||||
SettingsHolder->Visibility = ::Visibility::Visible;
|
rootFrame->Navigate((SettingsPage::typeid), this);
|
||||||
NavView->IsPaneOpen = false;
|
|
||||||
NavView->Visibility = ::Visibility::Collapsed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainPage::OnNavLoaded(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
void MainPage::OnNavLoaded(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e)
|
||||||
|
@ -449,12 +447,6 @@ void MainPage::OnSettingsButtonKeyDown(Object ^ sender, KeyRoutedEventArgs ^ e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainPage::CollapseSettings()
|
|
||||||
{
|
|
||||||
SettingsHolder->Visibility = ::Visibility::Collapsed;
|
|
||||||
NavView->Visibility = ::Visibility::Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainPage::OnNavSelectionChanged(_In_ Object ^ sender, _In_ MUXC::NavigationViewSelectionChangedEventArgs ^ e)
|
void MainPage::OnNavSelectionChanged(_In_ Object ^ sender, _In_ MUXC::NavigationViewSelectionChangedEventArgs ^ e)
|
||||||
{
|
{
|
||||||
auto item = dynamic_cast<MUXC::NavigationViewItem ^>(e->SelectedItemContainer);
|
auto item = dynamic_cast<MUXC::NavigationViewItem ^>(e->SelectedItemContainer);
|
||||||
|
|
|
@ -39,8 +39,6 @@ public
|
||||||
Platform::Object
|
Platform::Object
|
||||||
^> ^ CreateUIElementsForCategories(_In_ Windows::Foundation::Collections::IObservableVector<CalculatorApp::Common::NavCategoryGroup ^> ^ categories);
|
^> ^ CreateUIElementsForCategories(_In_ Windows::Foundation::Collections::IObservableVector<CalculatorApp::Common::NavCategoryGroup ^> ^ categories);
|
||||||
|
|
||||||
void CollapseSettings();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnNavigatedTo(_In_ Windows::UI::Xaml::Navigation::NavigationEventArgs ^ e) override;
|
void OnNavigatedTo(_In_ Windows::UI::Xaml::Navigation::NavigationEventArgs ^ e) override;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue