<Window 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="pdftron.PDF.Tools.AnnotationPropertiesPopup"
    xmlns:local="clr-namespace:pdftron.PDF.Tools"
    Title="Annotation Properties"
    Height="350"
    Width="300"
    MinHeight="200"
    MinWidth="200"
    MaxWidth="500"
    MaxHeight="500"
    ResizeMode="CanResizeWithGrip"
    ShowInTaskbar="False"
    WindowStartupLocation="CenterOwner">
    <Window.Resources>
        <Style TargetType="Button">
            <Setter Property="MinWidth" Value="50"/>
            <Setter Property="MinHeight" Value="20"/>
        </Style>
        <Style TargetType="Button" x:Key="ColorSelectionButtonStyle">
            <Setter Property="Width" Value="30"/>
            <Setter Property="Height" Value="30"/>
        </Style>
        <Style TargetType="Rectangle" x:Key="ColorSelectionRectangleStyle">
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="StrokeThickness" Value="0"/>
            <Setter Property="StrokeDashArray" Value="2 2"/>
            <Setter Property="Width" Value="24"/>
            <Setter Property="Height" Value="24"/>
            <Setter Property="Stroke" Value="#FF000000"/>
            <Setter Property="Margin" Value="3"/>
        </Style>
        <Style x:Key="TextBoxInError" TargetType="{x:Type TextBox}">
            <Style.Triggers>
                <Trigger Property="Validation.HasError" Value="true">
                    <Setter Property="ToolTip"
                    Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                    Path=(Validation.Errors)[0].ErrorContent}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!-- Content -->
        <StackPanel Orientation="Vertical" Visibility="Visible">
            <StackPanel.Resources>
                <Style TargetType="TextBlock" x:Key="ItemNameTextBlockStyle">
                    <Setter Property="MinWidth" Value="100"/>
                    <Setter Property="MinHeight" Value="20"/>
                    <Setter Property="HorizontalAlignment" Value="Left"/>
                    <Setter Property="VerticalAlignment" Value="Center"/>
                    <Setter Property="TextAlignment" Value="Right"/>
                    <Setter Property="Margin" Value="5 5 20 5"/>
                </Style>
                <Style TargetType="StackPanel">
                    <Setter Property="Visibility" Value="Visible"/>
                    <Setter Property="Orientation" Value="Horizontal"/>
                    <Setter Property="Margin" Value="0 5 2 0"/>
                </Style>
            </StackPanel.Resources>
            <StackPanel x:Name="LineColorOption" Visibility="Collapsed">
                <TextBlock Text="Line Color" Style="{StaticResource ItemNameTextBlockStyle}"/>
                <Button Style="{StaticResource ColorSelectionButtonStyle}" Click="LineColor_Click">
                    <Button.Content>
                        <Rectangle x:Name="LineColorRect" Style="{StaticResource ColorSelectionRectangleStyle}" />
                    </Button.Content>
                </Button>
            </StackPanel>
            <StackPanel x:Name="TextColorOption" Visibility="Collapsed">
                <TextBlock Text="Text Color" Style="{StaticResource ItemNameTextBlockStyle}"/>
                <Button Style="{StaticResource ColorSelectionButtonStyle}" Click="TextColor_Click">
                    <Rectangle x:Name="TextColorRect" Style="{StaticResource ColorSelectionRectangleStyle}"/>
                </Button>
            </StackPanel>
            <StackPanel x:Name="FillColorOption" Visibility="Collapsed">
                <TextBlock Text="Fill Color" Style="{StaticResource ItemNameTextBlockStyle}"/>
                <Button Style="{StaticResource ColorSelectionButtonStyle}" Click="FillColor_Click">
                    <Rectangle x:Name="FillColorRect" Style="{StaticResource ColorSelectionRectangleStyle}"/>
                </Button>
            </StackPanel>
            <StackPanel x:Name="LineThicknessOption" Visibility="Collapsed">
                <TextBlock Text="Line Thickness" Style="{StaticResource ItemNameTextBlockStyle}"/>
                <TextBox x:Name="LineThicknessBox" Width="100" Height="20" Style="{StaticResource TextBoxInError}" TextChanged="LineThicknessBox_TextChanged">
                    <Binding Path="ThicknessPathSource" UpdateSourceTrigger="PropertyChanged" Mode="OneWayToSource">
                        <Binding.ValidationRules>
                            <local:LineThicknessValidationRule x:Name="LineThicknessRule" MinThickness="0.5" MaxThickness="10" />
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox>
            </StackPanel>
            <StackPanel x:Name="LineStyleOption" Visibility="Collapsed">
                <TextBlock Text="Line Style" Style="{StaticResource ItemNameTextBlockStyle}"/>
                <ComboBox x:Name="LineStyleComboBox" SelectionChanged="LineStyleComboBox_SelectionChanged">
                    <TextBlock Text="Solid"/>
                    <TextBlock Text="Dotted"/>
                    <TextBlock Text="Dashed"/>
                    <TextBlock Text="Long Dashes"/>
                    <TextBlock Text="Custom"/>
                </ComboBox>
            </StackPanel>
            <StackPanel x:Name="LineStartStyleOption" Visibility="Collapsed">
                <TextBlock Text="Line Start Style" Style="{StaticResource ItemNameTextBlockStyle}"/>
                <ComboBox x:Name="LineStartStyleComboBox" SelectionChanged="LineStartStyleComboBox_SelectionChanged">
                    <TextBlock Text="None"/>
                    <TextBlock Text="Circle"/>
                    <TextBlock Text="Square"/>
                    <TextBlock Text="Diamond"/>
                    <TextBlock Text="Butt"/>
                    <TextBlock Text="Slash"/>
                    <TextBlock Text="Open Arrow"/>
                    <TextBlock Text="Closed Arrow"/>
                    <TextBlock Text="Reversed Open Arrow"/>
                    <TextBlock Text="Reversed Closed Arrow"/>
                    <TextBlock Text="Unknown"/>
                </ComboBox>
            </StackPanel>
            <StackPanel x:Name="LineEndStyleOption" Visibility="Collapsed">
                <TextBlock Text="Line End Style" Style="{StaticResource ItemNameTextBlockStyle}"/>
                <ComboBox x:Name="LineEndStyleComboBox" SelectionChanged="LineEndStyleComboBox_SelectionChanged">
                    <TextBlock Text="None"/>
                    <TextBlock Text="Circle"/>
                    <TextBlock Text="Square"/>
                    <TextBlock Text="Diamond"/>
                    <TextBlock Text="Butt"/>
                    <TextBlock Text="Slash"/>
                    <TextBlock Text="Open Arrow"/>
                    <TextBlock Text="Closed Arrow"/>
                    <TextBlock Text="Reversed Open Arrow"/>
                    <TextBlock Text="Reversed Closed Arrow"/>
                    <TextBlock Text="Unknown"/>
                </ComboBox>
            </StackPanel>
            <StackPanel x:Name="OpacityOption" Visibility="Collapsed">
                <TextBlock Text="Opacity" Style="{StaticResource ItemNameTextBlockStyle}"/>
                <StackPanel Orientation="Vertical">
                    <Grid>
                        <TextBlock Text="0" HorizontalAlignment="Left" MinWidth="10" Margin="0"/>
                        <TextBlock Text="{Binding ElementName=OpacitySlider, Path=Value}" HorizontalAlignment="Center" MinWidth="10" Margin="0"/>
                        <TextBlock Text="100" HorizontalAlignment="Right" MinWidth="10" Margin="0"/>
                    </Grid>
                    <Slider x:Name="OpacitySlider" Minimum="0" Maximum="100" Width="150" TickFrequency="1" IsSnapToTickEnabled="True" ValueChanged="OpacitySlider_ValueChanged"></Slider>
                </StackPanel>
            </StackPanel>
            <StackPanel x:Name="FontSizeOption" Visibility="Collapsed">
                <TextBlock Text="Font Size" Style="{StaticResource ItemNameTextBlockStyle}"/>
                <ComboBox x:Name="FontSizeComboBox" SelectionChanged="FontSize_SelectionChanged">
                </ComboBox>
            </StackPanel>
        </StackPanel>
        
        
        <!-- Accept or Cancel -->
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 3 25 3">

            <Button Name="OkButton" IsDefault="True" Click="OkButton_Click">OK</Button>
            <Button Name="OancelButton" IsCancel="True" Margin="15 0 0 0">Cancel</Button>
        </StackPanel>

    </Grid >

</Window>