<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:bpa="clr-namespace:BPA.UIControl">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/FlipView.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="ClockListBox"
           BasedOn="{StaticResource RubyerListBox}"
           TargetType="ListBox">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllControlCornerRadius}" />
        <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource AncestorType=bpa:Clock}}" />
        <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource AncestorType=bpa:Clock}}" />
        <Setter Property="bpa:ControlHelper.MaskOpacity" Value="1" />
        <Setter Property="bpa:ItemsControlHelper.ItemMargin" Value="5 0" />
        <Setter Property="bpa:ItemsControlHelper.ItemPadding" Value="2 4" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Visible" />
        <Style.Resources>
            <Style BasedOn="{StaticResource SmallScrollViewer}" TargetType="ScrollViewer">
                <Setter Property="bpa:ScrollViewerHelper.ScrollBarSize" Value="5" />
            </Style>
        </Style.Resources>
    </Style>

    <Style x:Key="RubyerClock" TargetType="{x:Type bpa:Clock}">
        <Setter Property="Background" Value="{DynamicResource FloatBackground}" />
        <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
        <Setter Property="Margin" Value="5" />
        <Setter Property="Height" Value="330" />
        <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
        <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Primary}" />
        <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource WhiteForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type bpa:Clock}">
                    <Grid>
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                Effect="{DynamicResource AllDirectionEffect3}" />
                        <Border x:Name="border"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>

                                <Border x:Name="content">
                                    <Grid MinWidth="200">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition />
                                            <ColumnDefinition />
                                        </Grid.ColumnDefinitions>

                                        <bpa:FlipView Style="{StaticResource SelecterFlipView}"
                                                      Grid.Column="0"
                                                      Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=Grid}}"
                                                      BorderBrush="{DynamicResource BorderLighter}"
                                                      BorderThickness="0 0 1 0"
                                                      ItemStringFormat="D2"
                                                      ItemsSource="{TemplateBinding Hours}"
                                                      SelectedItem="{Binding Hour, RelativeSource={RelativeSource Mode=TemplatedParent}}" />

                                        <bpa:FlipView Style="{StaticResource SelecterFlipView}"
                                                      Grid.Column="1"
                                                      Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=Grid}}"
                                                      ItemStringFormat="D2"
                                                      ItemsSource="{TemplateBinding Minutes}"
                                                      SelectedItem="{Binding Minute, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
                                    </Grid>
                                </Border>

                                <Button x:Name="PART_ConfirmButton"
                                        Grid.Row="1"
                                        Margin="5"
                                        Padding="20 5"
                                        Content="{DynamicResource I18N_Clock_Ok}"
                                        Visibility="{TemplateBinding IsShowConfirmButton, Converter={StaticResource BooleanToVisibleConverter}}" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ComboBoxClock" TargetType="{x:Type bpa:Clock}">
        <Setter Property="Background" Value="{DynamicResource FloatBackground}" />
        <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Padding" Value="5" />
        <Setter Property="Height" Value="Auto" />
        <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
        <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
        <Setter Property="bpa:ControlHelper.FocusBorderBrush" Value="{DynamicResource Primary}" />
        <Setter Property="bpa:ControlHelper.MouseOverBrush" Value="{DynamicResource Primary}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type bpa:Clock}">
                    <Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
                        <Border x:Name="border"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}">
                            <UniformGrid Margin="{TemplateBinding Padding}"
                                         Columns="2"
                                         Rows="1">
                                <ComboBox Grid.Column="0"
                                          Margin="0 0 2 0"
                                          bpa:ControlHelper.FocusBorderBrush="{Binding Path=(bpa:ControlHelper.FocusBorderBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                          bpa:ControlHelper.MouseOverBrush="{Binding Path=(bpa:ControlHelper.MouseOverBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                          bpa:InputBoxHelper.PostContent="{DynamicResource I18N_Clock_Hour}"
                                          bpa:ItemsControlHelper.ItemPadding="5 2"
                                          ItemStringFormat="D2"
                                          ItemsSource="{TemplateBinding Hours}"
                                          SelectedItem="{Binding Hour, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
                                <ComboBox Grid.Column="1"
                                          Margin="2 0"
                                          bpa:ControlHelper.FocusBorderBrush="{Binding Path=(bpa:ControlHelper.FocusBorderBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                          bpa:ControlHelper.MouseOverBrush="{Binding Path=(bpa:ControlHelper.MouseOverBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                          bpa:InputBoxHelper.PostContent="{DynamicResource I18N_Clock_Minute}"
                                          bpa:ItemsControlHelper.ItemPadding="5 2"
                                          ItemStringFormat="D2"
                                          ItemsSource="{TemplateBinding Minutes}"
                                          SelectedItem="{Binding Minute, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
                            </UniformGrid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>