<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c1="using:C1.Xaml">

    <DataTemplate x:Key="DayItemTemplate">
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
            <TextBlock Text="{Binding DayNumber}" Margin="0,0,6,0" />
            <TextBlock Text="{Binding DayName}" />
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="MonthItemTemplate">
        <TextBlock Text="{Binding MonthName}" />
    </DataTemplate>
    <DataTemplate x:Key="YearItemTemplate">
        <TextBlock Text="{Binding YearNumber}" />
    </DataTemplate>
    <DataTemplate x:Key="HourItemTemplate">
        <TextBlock Text="{Binding HourNumber}"  />
    </DataTemplate>
    <DataTemplate x:Key="MinuteItemTemplate">
        <TextBlock Text="{Binding MinuteNumber}"/>
    </DataTemplate>
    <DataTemplate x:Key="AMPMItemTemplate">
        <TextBlock Text="{Binding AMPMName}" />
    </DataTemplate>
    <Style TargetType="c1:C1DateSelector">
        <Setter Property="Foreground" Value="{ThemeResource ComboBoxForegroundThemeBrush}" />
        <Setter Property="Background" Value="{ThemeResource ComboBoxBackgroundThemeBrush}" />
        <Setter Property="BorderBrush" Value="{ThemeResource ComboBoxBorderThemeBrush}" />
        <Setter Property="BorderThickness" Value="{ThemeResource ComboBoxBorderThemeThickness}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="MinWidth" Value="300" />
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1:C1DateSelector">
                    <Grid VerticalAlignment="Center">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <ComboBox x:Name="DaysList" ItemTemplate="{StaticResource DayItemTemplate}" Grid.Column="0" 
                                  Margin="3" MinWidth="100" ItemContainerStyle="{TemplateBinding ItemStyle}"  
                                  Foreground="{TemplateBinding Foreground}"
                                  Background="{TemplateBinding Background}"
                                  BorderBrush="{TemplateBinding BorderBrush}"
                                  BorderThickness="{TemplateBinding BorderThickness}"
                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  HorizontalAlignment="Stretch"
                                  FontFamily="{TemplateBinding FontFamily}"
                                  FontSize="{TemplateBinding FontSize}"/>
                        <ComboBox x:Name="MonthsList" ItemTemplate="{StaticResource MonthItemTemplate}" Grid.Column="1" 
                                  Margin="3" MinWidth="84" ItemContainerStyle="{TemplateBinding ItemStyle}" 
                                  Foreground="{TemplateBinding Foreground}"
                                  Background="{TemplateBinding Background}"
                                  BorderBrush="{TemplateBinding BorderBrush}"
                                  BorderThickness="{TemplateBinding BorderThickness}"
                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  HorizontalAlignment="Stretch"
                                  FontFamily="{TemplateBinding FontFamily}"
                                  FontSize="{TemplateBinding FontSize}"/>
                        <ComboBox x:Name="YearsList" ItemTemplate="{StaticResource YearItemTemplate}" Grid.Column="2" 
                                  Margin="3" MinWidth="80" ItemContainerStyle="{TemplateBinding ItemStyle}" 
                                  Foreground="{TemplateBinding Foreground}"
                                  Background="{TemplateBinding Background}"
                                  BorderBrush="{TemplateBinding BorderBrush}"
                                  BorderThickness="{TemplateBinding BorderThickness}"
                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  HorizontalAlignment="Stretch"
                                  FontFamily="{TemplateBinding FontFamily}"
                                  FontSize="{TemplateBinding FontSize}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="c1:C1TimeSelector">
        <Setter Property="Foreground" Value="{ThemeResource ComboBoxForegroundThemeBrush}" />
        <Setter Property="Background" Value="{ThemeResource ComboBoxBackgroundThemeBrush}" />
        <Setter Property="BorderBrush" Value="{ThemeResource ComboBoxBorderThemeBrush}" />
        <Setter Property="BorderThickness" Value="{ThemeResource ComboBoxBorderThemeThickness}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1:C1TimeSelector">
                    <Grid VerticalAlignment="Center">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <ComboBox x:Name="HoursList" ItemTemplate="{StaticResource HourItemTemplate}" Grid.Column="0" 
                                  Margin="3" MinWidth="70" ItemContainerStyle="{TemplateBinding ItemStyle}" 
                                  Foreground="{TemplateBinding Foreground}"
                                  Background="{TemplateBinding Background}"
                                  BorderBrush="{TemplateBinding BorderBrush}"
                                  BorderThickness="{TemplateBinding BorderThickness}"
                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  HorizontalAlignment="Stretch"
                                  FontFamily="{TemplateBinding FontFamily}"
                                  FontSize="{TemplateBinding FontSize}"/>
                        <ComboBox x:Name="MinutesList" ItemTemplate="{StaticResource MinuteItemTemplate}" Grid.Column="1" 
                                  Margin="3" MinWidth="70" ItemContainerStyle="{TemplateBinding ItemStyle}" 
                                  Foreground="{TemplateBinding Foreground}"
                                  Background="{TemplateBinding Background}"
                                  BorderBrush="{TemplateBinding BorderBrush}"
                                  BorderThickness="{TemplateBinding BorderThickness}"
                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  HorizontalAlignment="Stretch"
                                  FontFamily="{TemplateBinding FontFamily}"
                                  FontSize="{TemplateBinding FontSize}"/>
                        <ComboBox x:Name="AMPMList" ItemTemplate="{StaticResource AMPMItemTemplate}" Grid.Column="2" 
                                  Margin="3" MinWidth="70" ItemContainerStyle="{TemplateBinding ItemStyle}" 
                                  Foreground="{TemplateBinding Foreground}"
                                  Background="{TemplateBinding Background}"
                                  BorderBrush="{TemplateBinding BorderBrush}"
                                  BorderThickness="{TemplateBinding BorderThickness}"
                                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  HorizontalAlignment="Stretch"
                                  FontFamily="{TemplateBinding FontFamily}"
                                  FontSize="{TemplateBinding FontSize}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="c1:C1DateTimeSelector">
        <Setter Property="Foreground" Value="{ThemeResource ComboBoxForegroundThemeBrush}" />
        <Setter Property="Background" Value="{ThemeResource ComboBoxBackgroundThemeBrush}" />
        <Setter Property="BorderBrush" Value="{ThemeResource ComboBoxBorderThemeBrush}" />
        <Setter Property="BorderThickness" Value="{ThemeResource ComboBoxBorderThemeThickness}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1:C1DateTimeSelector">
                    <c1:C1WrapPanel>
                        <c1:C1DateSelector x:Name="DateEditor" MinWidth="300"
                                           Foreground="{TemplateBinding Foreground}"
                                           Background="{TemplateBinding Background}"
                                           BorderBrush="{TemplateBinding BorderBrush}"
                                           BorderThickness="{TemplateBinding BorderThickness}"
                                           HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                           FontFamily="{TemplateBinding FontFamily}"
                                           FontSize="{TemplateBinding FontSize}"/>
                        <c1:C1TimeSelector x:Name="TimeEditor" 
                                           Foreground="{TemplateBinding Foreground}"
                                           Background="{TemplateBinding Background}"
                                           BorderBrush="{TemplateBinding BorderBrush}"
                                           BorderThickness="{TemplateBinding BorderThickness}"
                                           HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                           FontFamily="{TemplateBinding FontFamily}"
                                           FontSize="{TemplateBinding FontSize}"/>
                    </c1:C1WrapPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
