<UserControl x:Class="FormDesigner.CheckBoxPropertiesForm"
   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="350" 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/>
                        <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=CheckBoxField.Name, Mode=TwoWay}"/>

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

                    <Grid Grid.Row="2" Grid.ColumnSpan="2" Margin="6">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="30"/>
                            <RowDefinition Height="30"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="116"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="116"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Text="CheckBox Style:" VerticalAlignment="Center"/>
                        <ComboBox Grid.Column="1" Margin="2" ItemsSource="{Binding RadioButtonStyles}" SelectedItem="{Binding Path=CheckBoxWidget.CheckSymbolStyle, Mode=TwoWay}"/>

                        <TextBlock Grid.Row="0" Grid.Column="2" Text="Export value:" VerticalAlignment="Center"/>
                        <TextBox Grid.Row="0" Grid.Column="3" Margin="2" Text="{Binding Path=CheckBoxWidget.ExportValue, Mode=TwoWay}"/>

                        <CheckBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" VerticalAlignment="Center" Content="CheckBox is checked by default" IsChecked="{Binding Path=CheckBoxField.Checked, Mode=TwoWay}"/>
                    </Grid>
                </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=CheckBoxWidget.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=CheckBoxField.ReadOnly, Mode=TwoWay}"/>
                            <CheckBox Margin="2" Width="100" VerticalAlignment="Center" Content="Required" IsChecked="{Binding Path=CheckBoxField.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=CheckBoxWidget.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=CheckBoxWidget.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=CheckBoxWidget.BorderStyle, Mode=TwoWay}"/>

                        <TextBlock Grid.Column="2" Text="Border color:" VerticalAlignment="Center"/>
                        <local:ColorUserControl Grid.Column="3" Margin="2" SelectedColor="{Binding Path=CheckBoxWidget.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=CheckBoxWidget.BackColor, Mode=TwoWay, Converter={StaticResource pdfDeviceColorToSolidColorBrushConverter}}"/>
                    </Grid>

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

                        <TextBlock Grid.Row="0" Grid.Column="0" Text="Color:" VerticalAlignment="Center"/>
                        <local:ColorUserControl Grid.Row="0" Grid.Column="1" Margin="2" SelectedColor="{Binding Path=CheckBoxWidget.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>
