<Page
    x:Class="RichTextBoxSamples.AppBarDemo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:RichTextBoxSamples"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:c1RTB="using:C1.Xaml.RichTextBox" 
    mc:Ignorable="d">
    <Page.Resources>
        <local:Strings x:Key="Strings"/>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto "/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <CommandBar ClosedDisplayMode="Compact">
            <CommandBar.PrimaryCommands>
                <c1RTB:C1RedoTool x:Name="btnRedo" />
                <c1RTB:C1UndoTool x:Name="btnUndo" />
                <AppBarSeparator />
                <AppBarButton x:Name="btnInsertTable" Click="btnInsertTable_Click" Label="{Binding InsertTable_Content, Source={StaticResource Strings}}">
                    <FontIcon Glyph="&#x25A6;" FontFamily="FontFamily" />
                </AppBarButton>
                <AppBarButton x:Name="btnInsertHyperlink" Icon="Link" Click="btnInsertHyperlink_Click" Label="{Binding InsertHyperlink_Content, Source={StaticResource Strings}}"/>
                <AppBarButton x:Name="btnPicture" Icon="Pictures" Click="btnPicture_Click" Label="{Binding InsertPic_Content, Source={StaticResource Strings}}"/>
                <AppBarSeparator x:Name="insertSeparator" />
                <c1RTB:C1BoldTool x:Name="btnBold" />
                <c1RTB:C1ItalicTool x:Name="btnItalic" />
                <c1RTB:C1UnderlineTool x:Name="btnUnderline" />
            </CommandBar.PrimaryCommands>
            <CommandBar.SecondaryCommands>
                <c1RTB:C1IncreaseFontSizeTool x:Name="btnIncreaseFontSize" />
                <c1RTB:C1DecreaseFontSizeTool x:Name="btnDecreaseFontSize" />
                <AppBarSeparator />
                <c1RTB:C1LeftAlignTool x:Name="btnLeft"/>
                <c1RTB:C1CenterAlignTool x:Name="btnCenter"/>
                <c1RTB:C1RightAlignTool x:Name="btnRight"/>
                <AppBarSeparator />
                <AppBarToggleButton Icon="List" x:Name="btnList" Click="btnList_Click" Label="{Binding BulletedList, Source={StaticResource Strings}}"/>
                <AppBarButton Icon="FontColor" x:Name="btnFontColor" Click="btnFontColor_Click" Label="{Binding FontColor, Source={StaticResource Strings}}"/>
                <AppBarButton Icon="Highlight" x:Name="btnHighlight" Click="btnHighlight_Click" Label="{Binding Highlight, Source={StaticResource Strings}}"/>
            </CommandBar.SecondaryCommands>

        </CommandBar>
        <c1RTB:C1RichTextBox x:Name="rtb" Margin="0 16 0 0"  BorderThickness="2" BorderBrush="DarkGray" RequestNavigate="rtb_RequestNavigate" Grid.Row="1" />

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="WideLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="640" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="NarrowLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="0" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="insertSeparator.Visibility" Value="Collapsed" />
                        <Setter Target="btnInsertTable.Visibility" Value="Collapsed" />
                        <Setter Target="btnInsertHyperlink.Visibility" Value="Collapsed" />
                        <Setter Target="btnPicture.Visibility" Value="Collapsed" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>