RichTextBox for UWP | ComponentOne
Tutorials / Creating an AppBar Application / Step 2 of 5: Adding Resource Files and General Application Code
In This Topic
    Step 2 of 5: Adding Resource Files and General Application Code
    In This Topic
    In this step, you'll add the resource files that contain the styles and the content which your application will use. Right-click your application name and select Add | New Folder. Name the new folder Common.
    1. Right-click the Common folder and select Add | New Item.
    2. Select Blank Page from the available templates in the Add New Item dialog window, name it StandardStyles.xaml, and click OK.
    3. When the file opens, add the following XAML markup:
      XAML
      Copy Code
      <ResourceDictionary
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
          <!-- Non-brush values that vary across themes -->
          <ResourceDictionary.ThemeDictionaries>
              <ResourceDictionary x:Key="Default">
                  <x:String x:Key="BackButtonGlyph">&#xE071;</x:String>
                  <x:String x:Key="BackButtonSnappedGlyph">&#xE0BA;</x:String>
              </ResourceDictionary>
              <ResourceDictionary x:Key="HighContrast">
                  <x:String x:Key="BackButtonGlyph">&#xE071;</x:String>
                  <x:String x:Key="BackButtonSnappedGlyph">&#xE0C4;</x:String>
              </ResourceDictionary>
          </ResourceDictionary.ThemeDictionaries>
          <x:String x:Key="ChevronGlyph">&#xE26B;</x:String>
          <!-- RichTextBlock styles -->
          <Style x:Key="BasicRichTextStyle" TargetType="RichTextBlock">
              <Setter Property="Foreground" Value="{ThemeResource ApplicationForegroundThemeBrush}"/>
              <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
              <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
              <Setter Property="TextTrimming" Value="WordEllipsis"/>
              <Setter Property="TextWrapping" Value="Wrap"/>
              <Setter Property="Typography.StylisticSet20" Value="True"/>
              <Setter Property="Typography.DiscretionaryLigatures" Value="True"/>
              <Setter Property="Typography.CaseSensitiveForms" Value="True"/>
          </Style>
          <Style x:Key="BaselineRichTextStyle" TargetType="RichTextBlock" BasedOn="{StaticResource BasicRichTextStyle}">
              <Setter Property="LineHeight" Value="20"/>
              <Setter Property="LineStackingStrategy" Value="BlockLineHeight"/>
              <!-- Properly align text along its baseline -->
              <Setter Property="RenderTransform">
                  <Setter.Value>
                      <TranslateTransform X="-1" Y="4"/>
                  </Setter.Value>
              </Setter>
          </Style>
          <Style x:Key="ItemRichTextStyle" TargetType="RichTextBlock" BasedOn="{StaticResource BaselineRichTextStyle}"/>
          <Style x:Key="BodyRichTextStyle" TargetType="RichTextBlock" BasedOn="{StaticResource BaselineRichTextStyle}">
              <Setter Property="FontWeight" Value="SemiLight"/>
          </Style>
          <!-- TextBlock styles -->
          <Style x:Key="BasicTextStyle" TargetType="TextBlock">
              <Setter Property="Foreground" Value="{ThemeResource ApplicationForegroundThemeBrush}"/>
              <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
              <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
              <Setter Property="TextTrimming" Value="WordEllipsis"/>
              <Setter Property="TextWrapping" Value="Wrap"/>
              <Setter Property="Typography.StylisticSet20" Value="True"/>
              <Setter Property="Typography.DiscretionaryLigatures" Value="True"/>
              <Setter Property="Typography.CaseSensitiveForms" Value="True"/>
          </Style>
          <Style x:Key="BaselineTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BasicTextStyle}">
              <Setter Property="LineHeight" Value="20"/>
              <Setter Property="LineStackingStrategy" Value="BlockLineHeight"/>
              <!-- Properly align text along its baseline -->
              <Setter Property="RenderTransform">
                  <Setter.Value>
                      <TranslateTransform X="-1" Y="4"/>
                  </Setter.Value>
              </Setter>
          </Style>
          <Style x:Key="HeaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}">
              <Setter Property="FontSize" Value="56"/>
              <Setter Property="FontWeight" Value="Light"/>
              <Setter Property="LineHeight" Value="40"/>
              <Setter Property="RenderTransform">
                  <Setter.Value>
                      <TranslateTransform X="-2" Y="8"/>
                  </Setter.Value>
              </Setter>
          </Style>
          <Style x:Key="SubheaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}">
              <Setter Property="FontSize" Value="26.667"/>
              <Setter Property="FontWeight" Value="Light"/>
              <Setter Property="LineHeight" Value="30"/>
              <Setter Property="RenderTransform">
                  <Setter.Value>
                      <TranslateTransform X="-1" Y="6"/>
                  </Setter.Value>
              </Setter>
          </Style>
          <Style x:Key="TitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}">
              <Setter Property="FontWeight" Value="SemiBold"/>
          </Style>
          <Style x:Key="SubtitleTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}">
              <Setter Property="FontWeight" Value="Normal"/>
          </Style>
          <Style x:Key="ItemTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}"/>
          <Style x:Key="BodyTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}">
              <Setter Property="FontWeight" Value="SemiLight"/>
          </Style>
          <Style x:Key="CaptionTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}">
              <Setter Property="FontSize" Value="12"/>
              <Setter Property="Foreground" Value="{ThemeResource ApplicationSecondaryForegroundThemeBrush}"/>
          </Style>
          <Style x:Key="GroupHeaderTextStyle" TargetType="TextBlock">
              <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
              <Setter Property="TextTrimming" Value="WordEllipsis"/>
              <Setter Property="TextWrapping" Value="NoWrap"/>
              <Setter Property="Typography.StylisticSet20" Value="True"/>
              <Setter Property="Typography.DiscretionaryLigatures" Value="True"/>
              <Setter Property="Typography.CaseSensitiveForms" Value="True"/>
              <Setter Property="FontSize" Value="26.667"/>
              <Setter Property="LineStackingStrategy" Value="BlockLineHeight"/>
              <Setter Property="FontWeight" Value="Light"/>
              <Setter Property="LineHeight" Value="30"/>
              <Setter Property="RenderTransform">
                  <Setter.Value>
                      <TranslateTransform X="-1" Y="6"/>
                  </Setter.Value>
              </Setter>
          </Style>
          <!-- Button styles -->
          <!--
              TextButtonStyle is used to style a Button using subheader-styled text with no other adornment.  There
              are two styles that are based on TextButtonStyle (TextPrimaryButtonStyle and TextSecondaryButtonStyle)
              which are used in the GroupedItemsPage as a group header and in the FileOpenPickerPage for triggering
              commands.
          -->
          <Style x:Key="TextButtonStyle" TargetType="ButtonBase">
              <Setter Property="MinWidth" Value="0"/>
              <Setter Property="MinHeight" Value="0"/>
              <Setter Property="Template">
                  <Setter.Value>
                      <ControlTemplate TargetType="ButtonBase">
                          <Grid Background="Transparent">
                              <ContentPresenter x:Name="Text" Content="{TemplateBinding Content}" />
                              <Rectangle
                                  x:Name="FocusVisualWhite"
                                  IsHitTestVisible="False"
                                  Stroke="{ThemeResource FocusVisualWhiteStrokeThemeBrush}"
                                  StrokeEndLineCap="Square"
                                  StrokeDashArray="1,1"
                                  Opacity="0"
                                  StrokeDashOffset="1.5"/>
                              <Rectangle
                                  x:Name="FocusVisualBlack"
                                  IsHitTestVisible="False"
                                  Stroke="{ThemeResource FocusVisualBlackStrokeThemeBrush}"
                                  StrokeEndLineCap="Square"
                                  StrokeDashArray="1,1"
                                  Opacity="0"
                                  StrokeDashOffset="0.5"/>
                              <VisualStateManager.VisualStateGroups>
                                  <VisualStateGroup x:Name="CommonStates">
                                      <VisualState x:Name="Normal"/>
                                      <VisualState x:Name="PointerOver">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationPointerOverForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Pressed">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationPressedForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Disabled">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationPressedForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                  </VisualStateGroup>
                                  <VisualStateGroup x:Name="FocusStates">
                                      <VisualState x:Name="Focused">
                                          <Storyboard>
                                              <DoubleAnimation Duration="0" To="1" Storyboard.TargetName="FocusVisualWhite" Storyboard.TargetProperty="Opacity"/>
                                              <DoubleAnimation Duration="0" To="1" Storyboard.TargetName="FocusVisualBlack" Storyboard.TargetProperty="Opacity"/>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Unfocused"/>
                                  </VisualStateGroup>
                                  <VisualStateGroup x:Name="CheckStates">
                                      <VisualState x:Name="Checked"/>
                                      <VisualState x:Name="Unchecked">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationSecondaryForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Indeterminate"/>
                                  </VisualStateGroup>
                              </VisualStateManager.VisualStateGroups>
                          </Grid>
                      </ControlTemplate>
                  </Setter.Value>
              </Setter>
          </Style>
          <Style x:Key="MenuTextButtonStyle" TargetType="ButtonBase">
              <Setter Property="MinWidth" Value="0"/>
              <Setter Property="MinHeight" Value="0"/>
              <Setter Property="Template">
                  <Setter.Value>
                      <ControlTemplate TargetType="ButtonBase">
                          <Grid Background="Transparent">
                              <ContentPresenter x:Name="Text" Content="{TemplateBinding Content}" />
                              <Rectangle
                                  x:Name="FocusVisualWhite"
                                  IsHitTestVisible="False"
                                  Stroke="{ThemeResource FocusVisualWhiteStrokeThemeBrush}"
                                  StrokeEndLineCap="Square"
                                  StrokeDashArray="1,1"
                                  Opacity="0"
                                  StrokeDashOffset="1.5"/>
                              <Rectangle
                                  x:Name="FocusVisualBlack"
                                  IsHitTestVisible="False"
                                  Stroke="{ThemeResource FocusVisualBlackStrokeThemeBrush}"
                                  StrokeEndLineCap="Square"
                                  StrokeDashArray="1,1"
                                  Opacity="0"
                                  StrokeDashOffset="0.5"/>
                              <VisualStateManager.VisualStateGroups>
                                  <VisualStateGroup x:Name="CommonStates">
                                      <VisualState x:Name="Normal"/>
                                      <VisualState x:Name="PointerOver">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationPointerOverForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Pressed">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationPressedForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Disabled">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationPressedForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                  </VisualStateGroup>
                                  <VisualStateGroup x:Name="FocusStates">
                                      <VisualState x:Name="Focused">
                                          <Storyboard>
                                              <DoubleAnimation Duration="0" To="1" Storyboard.TargetName="FocusVisualWhite" Storyboard.TargetProperty="Opacity"/>
                                              <DoubleAnimation Duration="0" To="1" Storyboard.TargetName="FocusVisualBlack" Storyboard.TargetProperty="Opacity"/>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Unfocused"/>
                                  </VisualStateGroup>
                                  <VisualStateGroup x:Name="CheckStates">
                                      <VisualState x:Name="Checked"/>
                                      <VisualState x:Name="Unchecked">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ApplicationSecondaryForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Indeterminate"/>
                                  </VisualStateGroup>
                              </VisualStateManager.VisualStateGroups>
                          </Grid>
                      </ControlTemplate>
                  </Setter.Value>
              </Setter>
          </Style>
          <Style x:Key="TextPrimaryButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource TextButtonStyle}">
              <Setter Property="Foreground" Value="{ThemeResource ApplicationHeaderForegroundThemeBrush}"/>
          </Style>
          <Style x:Key="TextSecondaryButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource TextButtonStyle}">
              <Setter Property="Foreground" Value="{ThemeResource ApplicationSecondaryForegroundThemeBrush}"/>
          </Style>
          <!--
              TextRadioButtonStyle is used to style a RadioButton using subheader-styled text with no other adornment.
              This style is used in the SearchResultsPage to allow selection among filters.
          -->
          <Style x:Key="TextRadioButtonStyle" TargetType="RadioButton" BasedOn="{StaticResource TextButtonStyle}">
              <Setter Property="Margin" Value="0,0,30,0"/>
          </Style>
          <!--
              AppBarButtonStyle is used to style a Button (or ToggleButton) for use in an App Bar.  Content will be centered
              and should fit within the 40 pixel radius glyph provided.  16-point Segoe UI Symbol is used for content text
              to simplify the use of glyphs from that font.  AutomationProperties.Name is used for the text below the glyph.
          -->
          <Style x:Key="AppBarButtonStyle" TargetType="ButtonBase">
              <Setter Property="Foreground" Value="{ThemeResource AppBarItemForegroundThemeBrush}"/>
              <Setter Property="VerticalAlignment" Value="Stretch"/>
              <Setter Property="FontFamily" Value="Segoe UI Symbol"/>
              <Setter Property="FontWeight" Value="Normal"/>
              <Setter Property="FontSize" Value="20"/>
              <Setter Property="AutomationProperties.ItemType" Value="App Bar Button"/>
              <Setter Property="Template">
                  <Setter.Value>
                      <ControlTemplate TargetType="ButtonBase">
                          <Grid x:Name="RootGrid" Width="100" Background="Transparent">
                              <StackPanel VerticalAlignment="Top" Margin="0,12,0,11">
                                  <Grid Width="40" Height="40" Margin="0,0,0,5" HorizontalAlignment="Center">
                                      <TextBlock x:Name="BackgroundGlyph" Text="&#xE0A8;" FontFamily="Segoe UI Symbol" FontSize="53.333" Margin="-4,-19,0,0" Foreground="{ThemeResource AppBarItemBackgroundThemeBrush}"/>
                                      <TextBlock x:Name="OutlineGlyph" Text="&#xE0A7;" FontFamily="Segoe UI Symbol" FontSize="53.333" Margin="-4,-19,0,0"/>
                                      <ContentPresenter x:Name="Content" HorizontalAlignment="Center" Margin="-1,-1,0,0" VerticalAlignment="Center"/>
                                  </Grid>
                                  <TextBlock
                                      x:Name="TextLabel"
                                      Text="{TemplateBinding AutomationProperties.Name}"
                                      Foreground="{ThemeResource AppBarItemForegroundThemeBrush}"
                                      Margin="0,0,2,0"
                                      FontSize="12"
                                      TextAlignment="Center"
                                      Width="88"
                                      MaxHeight="32"
                                      TextTrimming="WordEllipsis"
                                      Style="{StaticResource BasicTextStyle}"/>
                              </StackPanel>
                              <Rectangle
                                      x:Name="FocusVisualWhite"
                                      IsHitTestVisible="False"
                                      Stroke="{ThemeResource FocusVisualWhiteStrokeThemeBrush}"
                                      StrokeEndLineCap="Square"
                                      StrokeDashArray="1,1"
                                      Opacity="0"
                                      StrokeDashOffset="1.5"/>
                              <Rectangle
                                      x:Name="FocusVisualBlack"
                                      IsHitTestVisible="False"
                                      Stroke="{ThemeResource FocusVisualBlackStrokeThemeBrush}"
                                      StrokeEndLineCap="Square"
                                      StrokeDashArray="1,1"
                                      Opacity="0"
                                      StrokeDashOffset="0.5"/>
                              <VisualStateManager.VisualStateGroups>
                                  <VisualStateGroup x:Name="ApplicationViewStates">
                                      <VisualState x:Name="FullScreenLandscape"/>
                                      <VisualState x:Name="Filled"/>
                                      <VisualState x:Name="FullScreenPortrait">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Visibility">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                              </ObjectAnimationUsingKeyFrames>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Width">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="60"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Snapped">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Visibility">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                              </ObjectAnimationUsingKeyFrames>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Width">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="60"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                  </VisualStateGroup>
                                  <VisualStateGroup x:Name="CommonStates">
                                      <VisualState x:Name="Normal"/>
                                      <VisualState x:Name="PointerOver">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemPointerOverBackgroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemPointerOverForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Pressed">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OutlineGlyph" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemPressedForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Disabled">
                                          <Storyboard>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OutlineGlyph" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemDisabledForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemDisabledForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemDisabledForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                  </VisualStateGroup>
                                  <VisualStateGroup x:Name="FocusStates">
                                      <VisualState x:Name="Focused">
                                          <Storyboard>
                                              <DoubleAnimation
                                                      Storyboard.TargetName="FocusVisualWhite"
                                                      Storyboard.TargetProperty="Opacity"
                                                      To="1"
                                                      Duration="0"/>
                                              <DoubleAnimation
                                                      Storyboard.TargetName="FocusVisualBlack"
                                                      Storyboard.TargetProperty="Opacity"
                                                      To="1"
                                                      Duration="0"/>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Unfocused" />
                                      <VisualState x:Name="PointerFocused" />
                                  </VisualStateGroup>
                                  <VisualStateGroup x:Name="CheckStates">
                                      <VisualState x:Name="Checked">
                                          <Storyboard>
                                              <DoubleAnimation Duration="0" To="0" Storyboard.TargetName="OutlineGlyph" Storyboard.TargetProperty="Opacity"/>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundCheckedGlyph" Storyboard.TargetProperty="Visibility">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                              </ObjectAnimationUsingKeyFrames>
                                              <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
                                                  <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemPressedForegroundThemeBrush}"/>
                                              </ObjectAnimationUsingKeyFrames>
                                          </Storyboard>
                                      </VisualState>
                                      <VisualState x:Name="Unchecked"/>
                                      <VisualState x:Name="Indeterminate"/>
                                  </VisualStateGroup>
                              </VisualStateManager.VisualStateGroups>
                          </Grid>
                      </ControlTemplate>
                  </Setter.Value>
              </Setter>
          </Style>
          <!--
              Standard AppBarButton Styles for use with Button and ToggleButton
        
              An AppBarButton Style is provided for each of the glyphs in the Segoe UI Symbol font.
              Uncomment any style you reference (as not all may be required).
          -->
          <Style x:Key="CopyAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
              <Setter Property="AutomationProperties.AutomationId" Value="CopyAppBarButton"/>
              <Setter Property="AutomationProperties.Name" Value="Copy"/>
              <Setter Property="Content" Value="&#xE16F;"/>
          </Style>
          <Style x:Key="PasteAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
              <Setter Property="AutomationProperties.AutomationId" Value="PasteAppBarButton"/>
              <Setter Property="AutomationProperties.Name" Value="Paste"/>
              <Setter Property="Content" Value="&#xE16D;"/>
          </Style>
          <Style x:Key="CutAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
              <Setter Property="AutomationProperties.AutomationId" Value="CutAppBarButton"/>
              <Setter Property="AutomationProperties.Name" Value="Cut"/>
              <Setter Property="Content" Value="&#xE16B;"/>
          </Style>
          <Style x:Key="UnderlineAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
              <Setter Property="AutomationProperties.AutomationId" Value="UnderlineAppBarButton"/>
              <Setter Property="AutomationProperties.Name" Value="Underline"/>
              <Setter Property="Content" Value="&#xE19A;"/>
          </Style>
          <Style x:Key="BoldAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
              <Setter Property="AutomationProperties.AutomationId" Value="BoldAppBarButton"/>
              <Setter Property="AutomationProperties.Name" Value="Bold"/>
              <Setter Property="Content" Value="&#xE19B;"/>
          </Style>
          <Style x:Key="ItalicAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
              <Setter Property="AutomationProperties.AutomationId" Value="ItalicAppBarButton"/>
              <Setter Property="AutomationProperties.Name" Value="Italic"/>
              <Setter Property="Content" Value="&#xE199;"/>
          </Style>
          <Style x:Key="MoreAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
              <Setter Property="AutomationProperties.AutomationId" Value="MoreAppBarButton"/>
              <Setter Property="AutomationProperties.Name" Value="More"/>
              <Setter Property="Content" Value="&#xE10C;"/>
          </Style>
          <Style x:Key="RedoAppBarButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource AppBarButtonStyle}">
              <!-- <Setter Property="AutomationProperties.AutomationId;"/> -->
      <Setter Property="AutomationProperties.Name" Value="Align Right"/>
              <Setter Property="Content" Value="&#xE1A0;"/>
          </Style>
      </ResourceDictionary>
      
    1. Right-click the Resources folder and select Add | New Item.
    2. Select HTML Page from the available templates in the Add New Item dialog window. Name the new file simple.htm.
    3. When the blank page opens, add the following markup:
      Example Title
      Copy Code
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
      <body style="font-size:medium">
      
          <p>
              Display and edit formatted text as HTML documents with <strong> RichTextBox<span style="font-size:x-small"><sup>TM</sup></span> for WinRT</strong>. Use the control to display HTML content from the Web or use it as a rich text editor. The <strong>C1RichTextBox</strong> control supports:
          </p>
          <ul style="line-height:1.5em">
              <li>
                 Most text <span style="background-color: yellow"><strong>decorations</strong></span>, <span style="color: red"><em>alignments</em></span> and <u>styles</u>
              </li>
              <li>
                 Bulleted and numbered lists
              </li>
              <li>
                 Clipboard and document history (undo and redo)
              </li>
              <li>
                 Hyperlinks: <a href="http://developer.mescius.com">MESCIUS website</a>
              </li>
              <li>
                 Insert tables and pictures
              </li>
          </ul>
      
      </body>
      </html>
      
    1. Select simple.htm in the Solution Explorer. In the Properties window, set the Build Action to Embedded Resource.
    2. Rebuild your application.
    1. Double-click the App.xaml file in the Solution Explorer and add the following markup:
      XAML
      Copy Code
      <Application.Resources>
        <ResourceDictionary>
          <ResourceDictionary.MergedDictionaries>
           <!-- Styles that define common aspects of the platform look and feel required by Visual Studio project and item templates -->
                 <ResourceDictionary Source="Common/StandardStyles.xaml"/>
               </ResourceDictionary.MergedDictionaries>
             </ResourceDictionary>
          </Application.Resources>
      

    In this step, you added and set the content for your application resources, and added the markup to apply those resources to your entire application. In the next step, you'll add general code for some of the AppBar items and to handle the C1RichTextBox events you added in the first step.