Skip to content

Instantly share code, notes, and snippets.

@mrlacey
Created July 14, 2019 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrlacey/b8b726d28e44b85bcc592390cc975e98 to your computer and use it in GitHub Desktop.
Save mrlacey/b8b726d28e44b85bcc592390cc975e98 to your computer and use it in GitHub Desktop.
UwpDesignTimeData Blog Demo
<Page
x:Class="App92.Views.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Style="{StaticResource PageStyle}"
xmlns:helper="using:App92.Helpers"
xmlns:xaml="using:Windows.UI.Xaml"
+ xmlns:dt="using:UwpDesignTimeData"
Width="600"
Height="400"
mc:Ignorable="d">
<Page.Resources>
<helper:EnumToBooleanConverter x:Key="EnumToBooleanConverter" EnumType="ElementTheme" />
</Page.Resources>
<Grid Margin="{StaticResource MediumLeftRightMargin}">
<StackPanel
x:Name="ContentArea">
<TextBlock
x:Uid="Settings_Personalization"
+ dt:DesignTime.Text="Personalization"
Style="{ThemeResource SubtitleTextBlockStyle}" />
<StackPanel Margin="{StaticResource SmallTopBottomMargin}">
<TextBlock
+ dt:DesignTime.Text="Choose Theme"
x:Uid="Settings_Theme" />
<StackPanel Margin="{StaticResource XSmallTopMargin}">
<RadioButton
x:Uid="Settings_Theme_Light"
GroupName="AppTheme"
+ dt:DesignTime.Content="Light"
Checked="ThemeChanged_CheckedAsync"
IsChecked="{x:Bind ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Light, Mode=OneWay}"
FontSize="15">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Light</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
<RadioButton
x:Uid="Settings_Theme_Dark"
GroupName="AppTheme"
+ dt:DesignTime.Content="Dark"
Checked="ThemeChanged_CheckedAsync"
IsChecked="{x:Bind ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Dark, Mode=OneWay}"
FontSize="15">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Dark</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
<RadioButton
x:Uid="Settings_Theme_Default"
GroupName="AppTheme"
+ dt:DesignTime.Content="Windows default"
Checked="ThemeChanged_CheckedAsync"
IsChecked="{x:Bind ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Default, Mode=OneWay}"
+ dt:DesignTime.IsChecked="True"
FontSize="15">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Default</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
</StackPanel>
</StackPanel>
<TextBlock
x:Uid="Settings_About"
+ dt:DesignTime.Text="About this application"
Style="{ThemeResource SubtitleTextBlockStyle}"/>
<StackPanel Margin="{StaticResource XSmallTopMargin}">
<TextBlock
Text="{x:Bind VersionDescription, Mode=OneWay}"
+ dt:DesignTime.Text="AppName - ver x.y.z"
Style="{ThemeResource BodyTextBlockStyle}" />
<TextBlock
x:Uid="Settings_AboutDescription"
+ dt:DesignTime.Text="App details will show here"
Margin="{StaticResource XSmallTopMargin}"
Style="{ThemeResource BodyTextBlockStyle}" />
<HyperlinkButton
x:Uid="Settings_PrivacyTermsLink"
+ dt:DesignTime.Content="Privacy policy"
Margin="{StaticResource XSmallTopMargin}" />
</StackPanel>
</StackPanel>
</Grid>
</Page>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment