<UserControl x:Class="ComPDFKit.Controls.Common.WritableComboBoxControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:ComPDFKit.Controls.Common"
             mc:Ignorable="d" 
             d:DesignHeight="24"
             d:DesignWidth="200">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
            <local:DocEditorResourceConverter x:Key="DocEditorResourceConverter"></local:DocEditorResourceConverter> 
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="20"/>
        </Grid.ColumnDefinitions>
        <ComboBox 
            x:Name="ComboBox"
            MinHeight="24" 
            MinWidth="60" 
            VerticalContentAlignment="Center"
            Grid.ColumnSpan="2" 
            SelectedIndex="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBoxControl}, Path=SelectedIndex}"
            SelectionChanged ="ComboBox_SelectionChanged"
            Style="{StaticResource ComboBoxStyle1}">
            <ComboBoxItem Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Range_All}" Tag="AllPages"></ComboBoxItem>
            <ComboBoxItem Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Range_Odd}" Tag="OddPages"></ComboBoxItem>
            <ComboBoxItem Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Range_Even}" Tag="EvenPages"></ComboBoxItem>
            <ComboBoxItem Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Range_Custom}" Tag="CustomPages"></ComboBoxItem>
        </ComboBox>
        <TextBox
                 x:Name="TextBox"
                 MinHeight="{Binding ElementName=ComboBox, Path=MinHeight}"
                 BorderBrush="{x:Null}"
                 BorderThickness="0"
                 Panel.ZIndex="1"
                 Margin="2"
                 Background="#CCCCCC"
                 PreviewKeyDown="TextBox_PreviewKeyDown"
                 InputMethod.IsInputMethodEnabled="False"
                 PreviewTextInput="TextBox_PreviewTextInput"
                 TextChanged="TextBox_TextChanged"
                 VerticalContentAlignment="Center"
                 Visibility="Hidden"></TextBox>
    </Grid>
</UserControl>
