<Page
    x:Class="InputSamples.TagEditor"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:InputSamples"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:input="using:C1.Xaml.Input"
    xmlns:rtb="using:C1.Xaml.RichTextBox"    
    xmlns:c1="using:C1.Xaml"    
    mc:Ignorable="d">
    <Page.Resources>
        <local:VisibleConverter x:Key="VisibleConverter"/>
        <local:SymbolIconConverter x:Key="SymbolIconConverter"/>
        <Style TargetType="input:C1Tag" x:Key="TagStyle">
            <Setter Property="Foreground" Value="#FFAE26A0"></Setter>
            <Setter Property="Background" Value="#FF7BB7DC"></Setter>
        </Style>
    </Page.Resources>
    <SplitView x:Name="RootView" CompactPaneLength="60" DisplayMode="CompactOverlay" IsPaneOpen="False" >
        <SplitView.Pane>
            <Grid Margin="5">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Button Margin="5" Background="Transparent" Command="{x:Bind ToggleSwitchCommand}" CommandParameter="{Binding ElementName=RootView}">
                    <SymbolIcon Symbol="{Binding ElementName=RootView,Path=IsPaneOpen,Converter={StaticResource SymbolIconConverter}}"/>
                </Button>
                <Grid Grid.Row="1"  Visibility="{Binding ElementName=RootView,Path=IsPaneOpen,Converter={StaticResource VisibleConverter}}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Margin="5" x:Uid="ContactList" Text="Contact List" />
                    <c1:C1ListBox x:Name="ContactList" ItemsSource="{x:Bind Mails}" Grid.Row="1" SelectedBackground="LawnGreen" Background="Black" SelectionChanged="OnListBoxSelectionChanged" HorizontalContentAlignment="Left" DisplayMemberPath="Name" Margin="5" />
                </Grid>
            </Grid>
        </SplitView.Pane>
        <Grid Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock x:Uid="From" Text="From" Margin="5" VerticalAlignment="Center" />
                <TextBlock Text="Robin Hendericks" Grid.Column="1" Margin="5" VerticalAlignment="Center" />
                <TextBlock x:Uid="To" Text="To" Grid.Row="1" Margin="5" VerticalAlignment="Top" />
                <input:C1TagEditor x:Name="AddressEditor" Margin="5" Grid.Row="1" Grid.Column="1" IsTagEditable="False" Separator=";" TagStyle="{StaticResource TagStyle}" 
                                   TagRemoved="OnAddressEditorTagRemoved" KeyDown="OnAddressEditorKeyDown" LostFocus="OnAddressEditorLostFocus" TextEdited="OnAddressEditorTextEdited" />
                <Popup x:Name="SuggestListPopup" Closed="OnSuggestListPopupClosed" Grid.Row="2" Grid.Column="1">
                    <c1:C1ListBox x:Name="SuggestList" Background="White" SelectionMode="Single" HorizontalScrollBarVisibility="Hidden" Width="300" VerticalScrollBarVisibility="Auto" HorizontalContentAlignment="Left" ItemHeight="40" BorderBrush="Black" BorderThickness="1" ItemTapped="OnItemTapped">
                        <c1:C1ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Name}" FontSize="10"/>
                                    <TextBlock Text=" &lt;" FontSize="10"/>
                                    <TextBlock Text="{Binding Address}" FontSize="10"/>
                                    <TextBlock Text="&gt;" FontSize="10"/>
                                </StackPanel>
                            </DataTemplate>
                        </c1:C1ListBox.ItemTemplate>
                    </c1:C1ListBox>
                </Popup>
                <TextBlock x:Uid="Subject" Text="Subject" Grid.Row="3" Margin="5" VerticalAlignment="Center"/>
                <TextBox x:Name="SubjectText" Grid.Row="3" Grid.Column="1" Margin="5" VerticalAlignment="Center"/>
            </Grid>
            <rtb:C1RichTextBox Grid.Row="1" />
            <Button x:Uid="Send" Content="Send" Grid.Row="2" Width="100" HorizontalAlignment="Right" Margin="5" Click="OnSendClick" />
        </Grid>
    </SplitView>
</Page>
