ChineseChess/ChineseChess.GUI/Views/SettingsPage.xaml
2021-05-30 22:57:53 +08:00

107 lines
5.9 KiB
XML

<Page
x:Class="ChineseChess.GUI.Views.SettingsPage"
Style="{DynamicResource MahApps.Styles.Page}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:converters="clr-namespace:ChineseChess.GUI.Converters"
xmlns:models="clr-namespace:ChineseChess.GUI.Models"
xmlns:properties="clr-namespace:ChineseChess.GUI.Properties"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Page.Resources>
<converters:EnumToBooleanConverter x:Key="EnumToBooleanConverter" EnumType="models:AppTheme" />
</Page.Resources>
<ScrollViewer>
<Grid Margin="{StaticResource SmallTopBottomMargin}">
<Grid.RowDefinitions>
<RowDefinition Height="48" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock
Style="{StaticResource PageTitleStyle}"
Text="{x:Static properties:Resources.SettingsPageTitle}" />
<StackPanel
x:Name="ContentArea"
Grid.Row="1"
Margin="{StaticResource MediumLeftRightMargin}">
<TextBlock
Margin="{StaticResource SmallTopMargin}"
Style="{StaticResource SubtitleTextStyle}"
Text="{x:Static properties:Resources.SettingsPagePersonalizationTitle}" />
<StackPanel Margin="{StaticResource SmallTopBottomMargin}">
<TextBlock
Style="{StaticResource BodyTextStyle}"
Text="{x:Static properties:Resources.SettingsPageChooseThemeText}" />
<StackPanel Margin="{StaticResource XSmallTopMargin}">
<RadioButton
GroupName="AppTheme"
Content="{x:Static properties:Resources.SettingsPageRadioButtonLightTheme}"
FontSize="{StaticResource MediumFontSize}"
IsChecked="{Binding Theme, Mode=OneWay, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Light}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Checked">
<i:InvokeCommandAction Command="{Binding SetThemeCommand}" CommandParameter="Light" />
</i:EventTrigger>
</i:Interaction.Triggers>
</RadioButton>
<RadioButton
GroupName="AppTheme"
Content="{x:Static properties:Resources.SettingsPageRadioButtonDarkTheme}"
Margin="{StaticResource XSmallTopMargin}"
FontSize="{StaticResource MediumFontSize}"
IsChecked="{Binding Theme, Mode=OneWay, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Dark}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Checked">
<i:InvokeCommandAction Command="{Binding SetThemeCommand}" CommandParameter="Dark" />
</i:EventTrigger>
</i:Interaction.Triggers>
</RadioButton>
<RadioButton
GroupName="AppTheme"
Content="{x:Static properties:Resources.SettingsPageRadioButtonWindowsDefaultTheme}"
FontSize="{StaticResource MediumFontSize}"
Margin="{StaticResource XSmallTopMargin}"
IsChecked="{Binding Theme, Mode=OneWay, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Default}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Checked">
<i:InvokeCommandAction Command="{Binding SetThemeCommand}" CommandParameter="Default" />
</i:EventTrigger>
</i:Interaction.Triggers>
</RadioButton>
</StackPanel>
</StackPanel>
<TextBlock
Margin="{StaticResource SmallTopMargin}"
Style="{StaticResource SubtitleTextStyle}"
Text="{x:Static properties:Resources.SettingsPageAboutTitle}" />
<TextBlock
Text="{Binding VersionDescription, Mode=OneWay}"
Margin="{StaticResource XSmallTopMargin}"
Style="{StaticResource BodyTextStyle}" />
<TextBlock
Margin="{StaticResource XSmallTopMargin}"
Style="{StaticResource BodyTextStyle}"
Text="{x:Static properties:Resources.SettingsPageAboutText}" />
<TextBlock
Margin="{StaticResource SmallTopMargin}"
AutomationProperties.Name="{Binding Text, ElementName=settingsPrivacyStatement}">
<Hyperlink
Command="{Binding PrivacyStatementCommand}"
AutomationProperties.Name="{Binding Text, ElementName=settingsPrivacyStatement}">
<TextBlock
x:Name="settingsPrivacyStatement"
Style="{StaticResource BodyTextStyle}"
Text="{x:Static properties:Resources.SettingsPagePrivacyStatementText}" />
</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>
</ScrollViewer>
</Page>