128 lines
10 KiB
XML
128 lines
10 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:HandyControl.Controls"
|
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="../Basic/Converters.xaml"/>
|
|
<ResourceDictionary Source="Base/TimePickerBaseStyle.xaml"/>
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
<Style BasedOn="{StaticResource TimePickerBaseStyle}" TargetType="controls:TimePicker"/>
|
|
|
|
<ControlTemplate x:Key="TimePickerExtendTopTemplate" TargetType="controls:TimePicker">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="{Binding Path=(controls:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
</Grid.RowDefinitions>
|
|
<StackPanel Visibility="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" Orientation="Horizontal" Margin="7,4">
|
|
<TextBlock Margin="1,0,0,0" Text="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
<ContentPresenter TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(controls:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(controls:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}"/>
|
|
</StackPanel>
|
|
<Border Grid.Row="1" x:Name="templateRoot" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
|
<Grid x:Name="PART_Root" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="30"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Button Style="{StaticResource ButtonIcon}" Padding="7" controls:IconElement.Geometry="{StaticResource ClockGeometry}" x:Name="PART_Button" Grid.Column="1" Foreground="{Binding BorderBrush,ElementName=templateRoot}" Focusable="False" Grid.Row="0"/>
|
|
<controls:WatermarkTextBox CaretBrush="{TemplateBinding Foreground}" x:Name="PART_TextBox" Padding="5,6" Margin="0,0,0,1" Watermark="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Stretch" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Grid.Row="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
|
<Popup Grid.Column="0" VerticalOffset="1" x:Name="PART_Popup" PopupAnimation="Fade" Placement="Bottom" PlacementTarget="{Binding ElementName=PART_TextBox}" StaysOpen="False">
|
|
<controls:Clock x:Name="PART_Clock" ShowConfirmButton="True"/>
|
|
</Popup>
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Opacity" TargetName="templateRoot" Value="0.4"/>
|
|
</Trigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsMouseOver" Value="true" SourceName="templateRoot"/>
|
|
<Condition Property="IsOpen" Value="false" SourceName="PART_Popup"/>
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
|
|
</MultiTrigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsMouseOver" Value="true" SourceName="templateRoot"/>
|
|
<Condition Property="IsOpen" Value="true" SourceName="PART_Popup"/>
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
|
</MultiTrigger>
|
|
<Trigger Property="IsFocused" Value="true" SourceName="PART_TextBox">
|
|
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{DynamicResource PrimaryBrush}"/>
|
|
</Trigger>
|
|
<Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<ControlTemplate x:Key="TimePickerExtendLeftTemplate" TargetType="controls:TimePicker">
|
|
<Grid Height="{Binding Path=(controls:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="{Binding Path=(controls:InfoElement.TitleWidth),RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
<ColumnDefinition/>
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Visibility="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" Orientation="Horizontal" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="0,7,6,8">
|
|
<TextBlock Text="{Binding Path=(controls:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
<ContentPresenter TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(controls:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(controls:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}"/>
|
|
</StackPanel>
|
|
<Border Grid.Column="1" x:Name="templateRoot" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
|
<Grid x:Name="PART_Root" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="30"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Button Style="{StaticResource ButtonIcon}" Padding="7" controls:IconElement.Geometry="{StaticResource ClockGeometry}" x:Name="PART_Button" Grid.Column="1" Foreground="{Binding BorderBrush,ElementName=templateRoot}" Focusable="False" Grid.Row="0"/>
|
|
<controls:WatermarkTextBox CaretBrush="{TemplateBinding Foreground}" x:Name="PART_TextBox" Padding="5,6" Margin="0,0,0,1" Watermark="{Binding Path=(controls:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Stretch" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Grid.Row="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
|
<Popup Grid.Column="0" VerticalOffset="1" x:Name="PART_Popup" PopupAnimation="Fade" Placement="Bottom" PlacementTarget="{Binding ElementName=PART_TextBox}" StaysOpen="False">
|
|
<controls:Clock x:Name="PART_Clock" ShowConfirmButton="True"/>
|
|
</Popup>
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Opacity" TargetName="templateRoot" Value="0.4"/>
|
|
</Trigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsMouseOver" Value="true" SourceName="templateRoot"/>
|
|
<Condition Property="IsOpen" Value="false" SourceName="PART_Popup"/>
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
|
|
</MultiTrigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsMouseOver" Value="true" SourceName="templateRoot"/>
|
|
<Condition Property="IsOpen" Value="true" SourceName="PART_Popup"/>
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
|
</MultiTrigger>
|
|
<Trigger Property="IsFocused" Value="true" SourceName="PART_TextBox">
|
|
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{DynamicResource PrimaryBrush}"/>
|
|
</Trigger>
|
|
<Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
|
|
<Style x:Key="TimePickerExtend" BasedOn="{StaticResource TimePickerBaseStyle}" TargetType="controls:TimePicker">
|
|
<Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
|
|
<Setter Property="Padding" Value="7,6"/>
|
|
<Setter Property="controls:InfoElement.Symbol" Value="●"/>
|
|
<Setter Property="Template" Value="{StaticResource TimePickerExtendTopTemplate}"/>
|
|
<Style.Triggers>
|
|
<Trigger Property="controls:InfoElement.TitleAlignment" Value="Left">
|
|
<Setter Property="Template" Value="{StaticResource TimePickerExtendLeftTemplate}"/>
|
|
<Setter Property="Width" Value="{x:Static system:Double.NaN}"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
</ResourceDictionary> |