<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf"
                    xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters">

	<converters:TextFieldHintVisibilityConverter x:Key="TextFieldHintVisibilityConverter" />
	
	<Style x:Key="MaterialDesignTimePicker" TargetType="{x:Type wpf:TimePicker}">
		<Setter Property="VerticalAlignment" Value="Top"/>
		<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/>
		<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignTextBoxBorder}" />
		<Setter Property="Background" Value="Transparent"/>
		<Setter Property="BorderThickness" Value="0 0 0 1"/>
		<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="wpf:TextFieldAssist.Hint" Value="Select time" />
		<Setter Property="ClockStyle" Value="{DynamicResource MaterialDesignClock}" />
		<Setter Property="ClockHostContentControlStyle">
			<Setter.Value>
				<Style TargetType="{x:Type ContentControl}">
					<Style.Setters>
						<Setter Property="Template">
							<Setter.Value>
								<ControlTemplate TargetType="{x:Type ContentControl}">
									<Border Effect="{DynamicResource MaterialDesignShadowDepth4}" Padding="16 8 16 24">
										<ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" />
									</Border>
								</ControlTemplate>
							</Setter.Value>
						</Setter>
					</Style.Setters>
				</Style>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type wpf:TimePicker}">
					<ControlTemplate.Resources>
						<ControlTemplate x:Key="TextBoxTemplate" TargetType="{x:Type TextBox}">
							<Grid>
								<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"											  
											  />
								<TextBlock Text="{Binding Path=(wpf:TextFieldAssist.Hint), RelativeSource={RelativeSource TemplatedParent}}"
										   Visibility="{TemplateBinding Text, Converter={StaticResource TextFieldHintVisibilityConverter}}"
										   x:Name="Hint"
										   Opacity="{Binding Path=(wpf:TextFieldAssist.HintOpacity), RelativeSource={RelativeSource TemplatedParent}}"/>
							</Grid>
						</ControlTemplate>
						<ControlTemplate x:Key="DropDownButtonTemplate" TargetType="{x:Type Button}">
							<Grid Background="Transparent">
								<VisualStateManager.VisualStateGroups>
									<VisualStateGroup x:Name="CommonStates">
										<VisualStateGroup.Transitions>
											<VisualTransition GeneratedDuration="0"/>
											<VisualTransition GeneratedDuration="0:0:0.1" To="MouseOver"/>
											<VisualTransition GeneratedDuration="0:0:0.1" To="Pressed"/>
										</VisualStateGroup.Transitions>
										<VisualState x:Name="Normal"/>
										<VisualState x:Name="MouseOver"/>
										<VisualState x:Name="Pressed"/>
										<VisualState x:Name="Disabled"/>
									</VisualStateGroup>
								</VisualStateManager.VisualStateGroups>
								<Viewbox>
									<Canvas Width="24" Height="24">
										<Path Data="M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z" Fill="{TemplateBinding Foreground}" />
									</Canvas>
								</Viewbox>
							</Grid>
						</ControlTemplate>
					</ControlTemplate.Resources>
					<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" 
							x:Name="border" Padding="0 4 0 4" SnapsToDevicePixels="True">
						<Grid>
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>							
							<TextBox BorderThickness="0" x:Name="PART_TextBox"											 									 
									 wpf:TextFieldAssist.TextBoxViewMargin="1 0 0 0"
									 Margin="0"                                     
									 Template="{StaticResource TextBoxTemplate}"									 
									 />
							<Button Grid.Column="1" Foreground="{TemplateBinding BorderBrush}" Focusable="False" HorizontalAlignment="Right" Margin="4 0 0 -3" Grid.Row="0" Padding="0"
									x:Name="PART_Button" 							
									Height="17"
									Template="{StaticResource DropDownButtonTemplate}" />
							<Popup x:Name="PART_Popup" AllowsTransparency="True" 
                                   Placement="Custom"
                                   CustomPopupPlacementCallback="{x:Static wpf:CustomPopupPlacementCallbackHelper.LargePopupCallback}"
                                   PlacementTarget="{Binding ElementName=PART_TextBox}" StaysOpen="False"
								   PopupAnimation="Fade"/>
						</Grid>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="true">
							<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueMidBrush}"/>
						</Trigger>
						<Trigger Property="IsKeyboardFocusWithin" Value="true">
							<Setter TargetName="border" Property="Padding" Value="0 4 0 3"/>
							<Setter Property="BorderThickness" Value="0 0 0 2"/>
							<Setter Property="BorderBrush"  Value="{DynamicResource PrimaryHueMidBrush}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>