<UserControl x:Class="FormDesigner.SignaturePropertiesForm"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:FormDesigner">

    <UserControl.Resources>
        <local:PDFDeviceColorToSolidColorBrushConverter x:Key="pdfDeviceColorToSolidColorBrushConverter"/>
        <local:BoolToVisibilityConverter x:Key="boolToVisibilityConverter"/>
        <local:ReverseBoolToVisibilityConverter x:Key="reverseBoolToVisibilityConverter"/>
    </UserControl.Resources>

    <Grid>
        <Grid Background="DarkGray" Opacity="0.4"/>

        <Grid Height="310" Width="500" HorizontalAlignment="Center" VerticalAlignment="Center">
            <Border Background="#FAFAFA" BorderBrush="Black" BorderThickness="2">
                <Border.Effect>
                    <DropShadowEffect Color="Black" Opacity="0.6" Direction="315" ShadowDepth="5"/>
                </Border.Effect>
            </Border>

            <Grid Background="#FAFAFA" Margin="7">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <TextBlock Text="Field name:" VerticalAlignment="Center"/>
                    <TextBox Grid.Column="1" Margin="2" Text="{Binding Path=SignatureField.Name, Mode=TwoWay}"/>

                    <TextBlock Grid.Row="1" Text="Tooltip:" VerticalAlignment="Center"/>
                    <TextBox Grid.Row="1" Grid.Column="1" Margin="2" Text="{Binding Path=SignatureField.Tooltip, Mode=TwoWay}"/>
                </Grid>

                <Grid Grid.Row="1" Margin="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <Grid Margin="6">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="30"/>
                            <RowDefinition Height="30"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="110"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="110"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Text="Visibility:" VerticalAlignment="Center"/>
                        <ComboBox Grid.Column="1" Margin="2" ItemsSource="{Binding PDFFieldWidgetVisibilityStatuses}" SelectedItem="{Binding Path=SignatureWidget.VisibilityStatus, Mode=TwoWay}"/>

                        <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Margin="2" Orientation="Horizontal">
                            <CheckBox Margin="2" Width="100" VerticalAlignment="Center" Content="Read only" IsChecked="{Binding Path=SignatureField.ReadOnly, Mode=TwoWay}"/>
                            <CheckBox Margin="2" Width="100" VerticalAlignment="Center" Content="Required" IsChecked="{Binding Path=SignatureField.NoExport, Mode=TwoWay}"/>
                            <CheckBox Margin="2" Width="100" VerticalAlignment="Center" Content="Locked" IsChecked="{Binding IsLocked, Mode=TwoWay}"/>
                        </StackPanel>

                        <TextBlock Grid.Column="2" Text="Orientation:" VerticalAlignment="Center"/>
                        <ComboBox Grid.Column="3" Margin="2" ItemsSource="{Binding PDFRotationModes}" SelectedItem="{Binding Path=SignatureWidget.Rotation, Mode=TwoWay}"/>
                    </Grid>

                    <Grid Grid.Row="1">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="30"/>
                            <RowDefinition Height="30"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="110"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="110"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Text="Border width:" VerticalAlignment="Center"/>
                        <ComboBox Grid.Column="1" Margin="2" ItemsSource="{Binding BorderWidths}" SelectedIndex="{Binding Path=SignatureWidget.BorderWidth, Mode=TwoWay}"/>

                        <TextBlock Grid.Row="1" Text="Border style:" VerticalAlignment="Center"/>
                        <ComboBox Grid.Row="1" Grid.Column="1" Margin="2" ItemsSource="{Binding PDFBorderStyles}" SelectedItem="{Binding Path=SignatureWidget.BorderStyle, Mode=TwoWay}"/>

                        <TextBlock Grid.Column="2" Text="Border color:" VerticalAlignment="Center"/>
                        <local:ColorUserControl Grid.Column="3" Margin="2" SelectedColor="{Binding Path=SignatureWidget.BorderColor, Mode=TwoWay, Converter={StaticResource pdfDeviceColorToSolidColorBrushConverter}}"/>

                        <TextBlock Grid.Row="1" Grid.Column="2" Text="Fill color:" VerticalAlignment="Center"/>
                        <local:ColorUserControl Grid.Row="1" Grid.Column="3" Margin="2" SelectedColor="{Binding Path=SignatureWidget.BackColor, Mode=TwoWay, Converter={StaticResource pdfDeviceColorToSolidColorBrushConverter}}"/>
                    </Grid>

                    <Grid Grid.Row="2">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="30"/>
                            <RowDefinition Height="30"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="110"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="110"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Text="Font:" VerticalAlignment="Center"/>
                        <ComboBox Grid.Column="1" Grid.ColumnSpan="3" Margin="2" ItemsSource="{Binding Fonts}" SelectedIndex="{Binding SelectedFontIndex, Mode=TwoWay}"/>

                        <TextBlock Grid.Row="1" Text="Size:" VerticalAlignment="Center"/>
                        <ComboBox Grid.Row="1" Grid.Column="1" Margin="2" ItemsSource="{Binding FontSizes}" SelectedValue="{Binding SelectedFontSize, Mode=TwoWay}"/>

                        <TextBlock Grid.Row="1" Grid.Column="2" Text="Color:" VerticalAlignment="Center"/>
                        <local:ColorUserControl Grid.Row="1" Grid.Column="3" Margin="2" SelectedColor="{Binding Path=SignatureWidget.TextColor, Mode=TwoWay, Converter={StaticResource pdfDeviceColorToSolidColorBrushConverter}}"/>
                    </Grid>
                </Grid>

                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="2" Margin="0,6,0,0">
                    <Button Margin="4" Width="100" Height="24" Content="OK" Click="Ok_Click" Visibility="{Binding IsCancelable, Converter={StaticResource boolToVisibilityConverter}}"/>
                    <Button Margin="4" Width="100" Height="24" Content="Cancel" Click="Cancel_Click" Visibility="{Binding IsCancelable, Converter={StaticResource boolToVisibilityConverter}}"/>
                    <Button Margin="4" Width="100" Height="24" Content="Close" Click="Ok_Click" Visibility="{Binding IsCancelable, Converter={StaticResource reverseBoolToVisibilityConverter}}"/>
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
