<Window
    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" mc:Ignorable="d" x:Class="Eto.Wpf.CustomControls.FontDialog.FontChooser" 
    Title="Select a Font" 
    SizeToContent="Height"
    Width="500"
    Background="{x:Static SystemColors.ControlBrush}" ShowInTaskbar="False" WindowStartupLocation="Manual"
    >
    <Grid Margin="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="70*" />
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="30*" />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!-- Row 0: Selection controls -->
        <Grid Grid.Column="0" Grid.Row="0" Name="selectionControls" Height="200">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*"/>
                <ColumnDefinition Width="12"/>
                <ColumnDefinition Width="2*"/>
                <ColumnDefinition Width="12"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="1*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <!-- Families -->
            <Label Grid.Column="0" Grid.Row="0" Content="_Font family"/>
            <DockPanel Grid.Column="0" Grid.Row="1" Grid.RowSpan="3">
                <TextBox DockPanel.Dock="Top" x:Name="fontFamilyTextBox"/>
                <ListBox x:Name="fontFamilyList" />
            </DockPanel>

            <!-- Family Typefaces (weight, style, stretch) -->
            <Label Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="2" Content="_Typeface:"/>
            <ListBox Grid.Column="2" Grid.Row="1" x:Name="typefaceList"/>

            <!-- Font sizes -->
            <Label Grid.Column="4" Grid.Row="0" Content="_Size:"/>
            <DockPanel Grid.Column="4" Grid.Row="1">
                <TextBox DockPanel.Dock="Top" x:Name="sizeTextBox"/>
                <ListBox x:Name="sizeList"/>
            </DockPanel>

            <!-- Text decorations -->
            <DockPanel Grid.Column="2" Grid.Row="2" Grid.ColumnSpan="3" Margin="0,16,0,-6" x:Name="decorations" Visibility="Collapsed">
                <CheckBox DockPanel.Dock="Top" Content="Underline" x:Name="underlineCheckBox"/>
                <CheckBox DockPanel.Dock="Top" Content="Baseline" x:Name="baselineCheckBox"/>
                <CheckBox DockPanel.Dock="Top" Content="Strikethrough" x:Name="strikethroughCheckBox"/>
                <CheckBox Content="Overline" x:Name="overlineCheckBox"/>
            </DockPanel>
        </Grid>

        <TabControl Grid.Column="0" Grid.Row="2" Margin="0,8,0,0" x:Name="tabControl" Height="150" Width="300" Visibility="Collapsed">
            <TabItem Header="Family and typeface samples" x:Name="samplesTab">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="12"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Column="0" Grid.Row="0"><Run Text="FontFamily:"/><Run Text=" "/><Run x:Name="fontFamilyNameRun"/></TextBlock>
                    <RichTextBox 
						Grid.Column="0" Grid.Row="1" 
						IsReadOnly="True" 
						VerticalScrollBarVisibility="Auto"
						x:Name="fontFamilySamples"
                        />
                    <TextBlock Grid.Column="2" Grid.Row="0"><Run Text="Typeface:"/><Run Text=" "/><Run x:Name="typefaceNameRun" Text="Points"/></TextBlock>
                    <RichTextBox 
						Grid.Column="2" Grid.Row="1" 
						IsReadOnly="True" 
						VerticalScrollBarVisibility="Auto"
						x:Name="typefaceSamples"
                        />
                </Grid>
            </TabItem>
            <TabItem Header="Typographic Features" x:Name="typographyTab">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="8"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <!-- Feature list of left-hand side of typography tab -->
                    <Label Grid.Column="0" Grid.Row="0" Content="Feature"/>
                    <ListBox Grid.Column="0" Grid.Row="1" x:Name="featureList" MinWidth="192"/>

                    <!-- Column headers on right-hand side of typography tab -->
                    <Grid Grid.Column="2" Grid.Row="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1"/>
                            <ColumnDefinition Width="96"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="1" Content="Selection"/>
                        <Label Grid.Column="2" Content="Sample"/>
                    </Grid>

                    <!-- Feature page -->
                    <Border Grid.Column="2" Grid.Row="1" BorderThickness="1" BorderBrush="{x:Static SystemColors.ControlDarkDarkBrush}">
                        <ScrollViewer VerticalScrollBarVisibility="Auto">
                            <Grid x:Name="typographyFeaturePage">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="96"/>
                                    <ColumnDefinition/>
                                    <!-- The grid contents for each feature are filled in programmatically -->
                                </Grid.ColumnDefinitions>
                            </Grid>
                        </ScrollViewer>
                    </Border>
                </Grid>
            </TabItem>
            <TabItem Header="DescriptiveText" x:Name="descriptiveTextTab">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="3*"/>
                        <ColumnDefinition Width="8"/>
                        <ColumnDefinition Width="2*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <Label Grid.Column="0" Grid.Row="0" Content="Font description:"/>
                    <RichTextBox 
						Grid.Column="0" Grid.Row="1" 
						IsReadOnly="True" 
						VerticalScrollBarVisibility="Auto"
						x:Name="fontDescriptionBox"
                        />

                    <Label Grid.Column="2" Grid.Row="0" Content="License:"/>
                    <TextBox 
						Grid.Column="2" Grid.Row="1" 
						IsReadOnly="True" 
						TextWrapping="WrapWithOverflow" 
						VerticalScrollBarVisibility="Auto" 
						x:Name="fontLicenseBox"
                        />
                </Grid>
            </TabItem>
        </TabControl>

        <!-- Row 2: Preview text -->
        <DockPanel Grid.Column="0" Grid.Row="3" Margin="0,12,0,0" Name="preview" Height="80" >
            <TextBlock DockPanel.Dock="Top"><Run Text="Preview:"/></TextBlock>
            <TextBox
				FontSize="16" AcceptsReturn="True" 
				TextAlignment="Center" 
				TextWrapping="Wrap"
				VerticalScrollBarVisibility="Auto"
				x:Name="previewTextBox"
                Text="The quick brown fox jumps over the lazy dog"
                />
        </DockPanel>

        <!-- Row 3: OK and Cancel buttons -->
        <StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0" Width="196">
            <Button Content="OK" Width="86" IsDefault="True" Click="OnOKButtonClicked" Margin="6,0"/>
            <Button Content="Cancel" Width="86" Click="OnCancelButtonClicked" Margin="6,0" IsCancel="True"/>
        </StackPanel>

    </Grid>
</Window>
