<UserControl x:Class="WPFCatalog.Controls.TextSettingsControl"
             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"
            xmlns:wpfCatalog="clr-namespace:WPFCatalog"
            xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
            xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
             xmlns:System="clr-namespace:System;assembly=mscorlib"
            xmlns:catalogLib="clr-namespace:CatalogLib;assembly=CatalogLib"
            mc:Ignorable="d" 
             d:DesignHeight="900" d:DesignWidth="500"
             d:DataContext="{d:DesignInstance wpfCatalog:MainWindowViewModel}" >
    <UserControl.Resources>
        <wpfCatalog:FontFamilyStringConverter x:Key="FontFamilyConverter" />
        <wpfCatalog:MaddoColorConverter x:Key="ColorConverter" />
        <ObjectDataProvider x:Key="PositionsEnum" MethodName="GetValues" ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="catalogLib:Positions" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider x:Key="AlignmentEnum" MethodName="GetValues" ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="catalogLib:Alignments" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </UserControl.Resources>
    <ScrollViewer>
        <StackPanel Orientation="Vertical">
            <Controls:ToggleSwitch Header="Inserimento testo" IsChecked="{Binding EnableText}" />
            <GroupBox Header="Carattere">

                <Grid >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Button Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"  Content="Scegli" Command="{Binding PickFontCommand}"></Button>

                    <Label Grid.Row="1" Grid.Column="0"  Content="Font"/>
                    <TextBox   Grid.Row="1" Grid.Column="1"
                                              
                                              IsReadOnly="True"
                                              FontFamily="{Binding FontName, Converter={StaticResource FontFamilyConverter}, Mode=OneWay}"
                                              Text="{Binding FontName}" 
                                              ></TextBox>
                    <Label Content="Grassetto" Grid.Row="2" Grid.Column="0"></Label>
                    <CheckBox Grid.Row="2" Grid.Column="1" IsChecked="{Binding Grassetto}"></CheckBox>

                    <Label Content="Corsivo" Grid.Row="3" Grid.Column="0"></Label>
                    <CheckBox Grid.Row="3" Grid.Column="1"></CheckBox>

                    <Label Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" Content="Dimensione"/>
                    <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding FontSize}"/>


                    <Label Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" Content="Dimensione Miniatura"/>
                    <TextBox Grid.Row="5" Grid.Column="1" Text="{Binding CarattereDimensioneMiniatura}"/>


                    <Label Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" Content="Colore RGB" />

                    <xctk:ColorPicker Grid.Row="6" Grid.Column="1" SelectedColor="{Binding ColoreTestoRGB, Converter={StaticResource ColorConverter}}"/>

                </Grid>


                <!--<ComboBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Width="100" HorizontalAlignment="Right" SelectedItem="{Binding CarattereFont}" x:Name="cmbFont" />-->

                <!---->

                                    <!--<CheckBox Grid.Row="0" Grid.Column="3" Content="Grassetto" VerticalAlignment="Center" IsChecked="{Binding CarattereGrassetto}" />-->








                <!--<Button Grid.Row="3" Grid.Column="3" Content="Scegli..." />-->



            </GroupBox>
            <StackPanel Orientation="Vertical" VerticalAlignment="Stretch">
               
                

            </StackPanel>
            <GroupBox Header="Testo da applicare">
                <StackPanel Orientation="Vertical">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Label Grid.Row="0" Grid.Column="0" Content="Orizzontale" />
                        <Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" >
                            <TextBlock>
                                Legenda:<LineBreak/>
                                $_ A capo verticale<LineBreak/>
                                $o Orario<LineBreak/>
                                $t Tempo gara<LineBreak/>
                                $n Nome File
                            </TextBlock>
                            
                            
                        </Label>
                        <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TestoApplicareOrizzontale}" AcceptsReturn="True"/>
                        
                    </Grid>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />

                        </Grid.ColumnDefinitions>
                        <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="Trasparenza(0-100%)" />
                        <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TestoApplicareTrasparenza}" />

                        <Label Grid.Row="1" Grid.Column="0" Content="Allineamento Verticale" />
                        <ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Source={StaticResource PositionsEnum}}" SelectedItem="{Binding TextPosition}">

                        </ComboBox>

                        <ComboBox Grid.Row="2" Grid.Column="2" ItemsSource="{Binding Source={StaticResource AlignmentEnum}}" SelectedItem="{Binding TextAlignment}"></ComboBox>

                        <Label Grid.Row="6" Grid.Column="0" >Formato tempo gara</Label>
                        <TextBox Grid.Row="6" Grid.Column="1"  Text="{Binding TestoApplicareTempoGara}"/>

                        <Label Grid.Row="5" Grid.Column="0"  Content="Margine (pixel)"  />
                        <TextBox Grid.Row="5" Grid.Column="1"  Text="{Binding Margine}"/>


                        <Label Grid.Row="7" Grid.Column="0" Content="Partenza" />
                        <xctk:DateTimePicker Grid.Row="7" Grid.Column="1"></xctk:DateTimePicker>
                        
                        <!--todo-->
                    </Grid>
                </StackPanel>
            </GroupBox>
        </StackPanel>
    </ScrollViewer>
</UserControl>
