-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8626729
commit c8de3c7
Showing
1 changed file
with
273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,273 @@ | ||
<ResourceDictionary | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="clr-namespace:WPFDevelopers.Controls" | ||
xmlns:helpers="clr-namespace:WPFDevelopers.Helpers"> | ||
|
||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="Basic/ControlBasic.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
|
||
<ControlTemplate x:Key="WD.TimePickerToggleButton" TargetType="{x:Type ToggleButton}"> | ||
<Border | ||
x:Name="PART_Border" | ||
Padding="6,0" | ||
Background="Transparent" | ||
BorderThickness="0" | ||
SnapsToDevicePixels="true"> | ||
<controls:PathIcon | ||
x:Name="PART_PathIcon" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
Foreground="{DynamicResource WD.PlaceholderTextSolidColorBrush}" | ||
IsHitTestVisible="False" | ||
Kind="Time" /> | ||
</Border> | ||
<ControlTemplate.Triggers> | ||
<Trigger Property="IsMouseOver" Value="True"> | ||
<Setter TargetName="PART_PathIcon" Property="Foreground" Value="{DynamicResource WD.PrimaryNormalSolidColorBrush}" /> | ||
</Trigger> | ||
<Trigger Property="IsChecked" Value="True"> | ||
<Setter TargetName="PART_PathIcon" Property="Foreground" Value="{DynamicResource WD.PrimaryNormalSolidColorBrush}" /> | ||
</Trigger> | ||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
<Style | ||
x:Key="WD.TimeSelectorItem" | ||
BasedOn="{StaticResource WD.DefaultListBoxItem}" | ||
TargetType="{x:Type controls:TimeSelectorItem}"> | ||
<Setter Property="BorderThickness" Value="0" /> | ||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type controls:TimeSelectorItem}"> | ||
<ControlTemplate.Triggers> | ||
<Trigger Property="IsSelected" Value="True"> | ||
<Setter Property="FontWeight" Value="Bold" /> | ||
<Setter Property="Background" Value="Transparent" /> | ||
</Trigger> | ||
<Trigger Property="IsMouseOver" Value="True"> | ||
<Setter Property="Background" Value="{DynamicResource WD.BaseSolidColorBrush}" /> | ||
</Trigger> | ||
<DataTrigger Binding="{Binding}" Value=""> | ||
<Setter Property="IsEnabled" Value="False" /> | ||
</DataTrigger> | ||
</ControlTemplate.Triggers> | ||
<controls:SmallPanel> | ||
<Border | ||
Name="PART_Border" | ||
Padding="{TemplateBinding Padding}" | ||
Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
SnapsToDevicePixels="True"> | ||
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | ||
</Border> | ||
</controls:SmallPanel> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<Style | ||
x:Key="WD.TimeListStyle" | ||
BasedOn="{StaticResource WD.DefaultListBox}" | ||
TargetType="{x:Type controls:TimeSelectorListBox}"> | ||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" /> | ||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" /> | ||
<Setter Property="BorderThickness" Value="0" /> | ||
<Setter Property="ItemContainerStyle" Value="{StaticResource WD.TimeSelectorItem}" /> | ||
<Style.Triggers> | ||
<Trigger Property="IsMouseOver" Value="True"> | ||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> | ||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> | ||
</Trigger> | ||
</Style.Triggers> | ||
</Style> | ||
|
||
|
||
<Style | ||
x:Key="WD.TimeSelector" | ||
BasedOn="{StaticResource WD.ControlBasicStyle}" | ||
TargetType="{x:Type controls:TimeSelector}"> | ||
<Setter Property="HorizontalContentAlignment" Value="Left" /> | ||
<Setter Property="VerticalContentAlignment" Value="Center" /> | ||
<Setter Property="Padding" Value="{StaticResource WD.DefaultPadding}" /> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type controls:TimeSelector}"> | ||
<Border | ||
Padding="{TemplateBinding Padding}" | ||
Background="{TemplateBinding Background}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" | ||
UseLayoutRounding="{TemplateBinding UseLayoutRounding}"> | ||
<controls:SmallPanel SnapsToDevicePixels="True"> | ||
<UniformGrid Rows="1"> | ||
<controls:TimeSelectorListBox x:Name="PART_ListBoxHour" Style="{StaticResource WD.TimeListStyle}" /> | ||
<controls:TimeSelectorListBox x:Name="PART_ListBoxMinute" Style="{StaticResource WD.TimeListStyle}" /> | ||
<controls:TimeSelectorListBox x:Name="PART_ListBoxSecond" Style="{StaticResource WD.TimeListStyle}" /> | ||
</UniformGrid> | ||
<Line /> | ||
<Path /> | ||
<Border | ||
Height="{TemplateBinding ItemHeight}" | ||
Margin="{TemplateBinding SelectorMargin}" | ||
VerticalAlignment="Top" | ||
BorderBrush="{DynamicResource WD.BaseSolidColorBrush}" | ||
BorderThickness="0,1" | ||
IsHitTestVisible="False" /> | ||
</controls:SmallPanel> | ||
</Border> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<Style | ||
x:Key="WD.TimePicker" | ||
BasedOn="{StaticResource WD.ControlBasicStyle}" | ||
TargetType="{x:Type controls:TimePicker}"> | ||
<Setter Property="HorizontalContentAlignment" Value="Left" /> | ||
<Setter Property="VerticalContentAlignment" Value="Center" /> | ||
<Setter Property="BorderBrush" Value="{DynamicResource WD.BaseSolidColorBrush}" /> | ||
<Setter Property="BorderThickness" Value="1" /> | ||
<Setter Property="Background" Value="{DynamicResource WD.BackgroundSolidColorBrush}" /> | ||
<Setter Property="Padding" Value="{StaticResource WD.DefaultPadding}" /> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type controls:TimePicker}"> | ||
<ControlTemplate.Resources> | ||
<Storyboard x:Key="OpenStoryboard"> | ||
<DoubleAnimation | ||
EasingFunction="{StaticResource WD.ExponentialEaseOut}" | ||
Storyboard.TargetName="PART_DropDown" | ||
Storyboard.TargetProperty="(Grid.RenderTransform).(ScaleTransform.ScaleY)" | ||
To="1" | ||
Duration="00:00:.2" /> | ||
</Storyboard> | ||
<Storyboard x:Key="CloseStoryboard"> | ||
<DoubleAnimation | ||
EasingFunction="{StaticResource WD.ExponentialEaseOut}" | ||
Storyboard.TargetName="PART_DropDown" | ||
Storyboard.TargetProperty="(Grid.RenderTransform).(ScaleTransform.ScaleY)" | ||
To="0" | ||
Duration="00:00:.2" /> | ||
</Storyboard> | ||
</ControlTemplate.Resources> | ||
<controls:SmallPanel SnapsToDevicePixels="True"> | ||
<Grid Background="Transparent"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
<Border | ||
Name="PART_Border" | ||
Grid.ColumnSpan="2" | ||
Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
CornerRadius="{Binding Path=(helpers:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}" | ||
SnapsToDevicePixels="True" /> | ||
<TextBox | ||
x:Name="PART_EditableTextBox" | ||
Margin="{TemplateBinding Padding}" | ||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | ||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | ||
Background="{TemplateBinding Background}" | ||
Focusable="True" | ||
Foreground="{DynamicResource WD.PrimaryTextSolidColorBrush}" | ||
SelectionBrush="{DynamicResource WD.WindowBorderBrushSolidColorBrush}" | ||
Style="{x:Null}" | ||
Template="{StaticResource WD.ComboBoxTextBox}" /> | ||
<TextBlock | ||
x:Name="PART_Watermark" | ||
Margin="{TemplateBinding Padding}" | ||
Padding="1,0" | ||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | ||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | ||
Background="Transparent" | ||
FontSize="{StaticResource WD.NormalFontSize}" | ||
Foreground="{DynamicResource WD.RegularTextSolidColorBrush}" | ||
IsHitTestVisible="False" | ||
Text="{Binding Path=(helpers:ElementHelper.Watermark), RelativeSource={RelativeSource TemplatedParent}}" | ||
TextTrimming="CharacterEllipsis" | ||
Visibility="Collapsed" /> | ||
<ToggleButton | ||
x:Name="PART_ToggleButton" | ||
Grid.Column="1" | ||
Background="{TemplateBinding Background}" | ||
ClickMode="Release" | ||
Focusable="False" | ||
Style="{x:Null}" | ||
Template="{StaticResource WD.TimePickerToggleButton}" /> | ||
<Popup | ||
x:Name="PART_Popup" | ||
AllowsTransparency="True" | ||
IsOpen="{Binding Path=IsChecked, ElementName=PART_ToggleButton}" | ||
Placement="Bottom" | ||
PlacementTarget="{Binding ElementName=PART_Border}" | ||
StaysOpen="False"> | ||
<controls:SmallPanel | ||
x:Name="PART_DropDown" | ||
MinWidth="{TemplateBinding FrameworkElement.ActualWidth}" | ||
MaxHeight="{TemplateBinding MaxDropDownHeight}" | ||
Margin="24,2,24,24" | ||
RenderTransformOrigin=".5,0" | ||
SnapsToDevicePixels="True"> | ||
<controls:SmallPanel.RenderTransform> | ||
<ScaleTransform ScaleY="0" /> | ||
</controls:SmallPanel.RenderTransform> | ||
<Border | ||
Name="PART_DropDownBorder" | ||
Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
CornerRadius="{Binding Path=(helpers:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}" | ||
Effect="{StaticResource WD.PopupShadowDepth}" | ||
SnapsToDevicePixels="True" | ||
UseLayoutRounding="True" /> | ||
<controls:TimeSelector x:Name="PART_TimeSelector" /> | ||
</controls:SmallPanel> | ||
</Popup> | ||
</Grid> | ||
</controls:SmallPanel> | ||
<ControlTemplate.Triggers> | ||
<Trigger SourceName="PART_ToggleButton" Property="IsChecked" Value="True"> | ||
<Trigger.EnterActions> | ||
<BeginStoryboard x:Name="BeginStoryboardOpenStoryboard" Storyboard="{StaticResource OpenStoryboard}" /> | ||
</Trigger.EnterActions> | ||
<Trigger.ExitActions> | ||
<StopStoryboard BeginStoryboardName="BeginStoryboardOpenStoryboard" /> | ||
</Trigger.ExitActions> | ||
</Trigger> | ||
<Trigger SourceName="PART_ToggleButton" Property="IsChecked" Value="False"> | ||
<Trigger.EnterActions> | ||
<BeginStoryboard x:Name="BeginStoryboardCloseStoryboard" Storyboard="{StaticResource CloseStoryboard}" /> | ||
</Trigger.EnterActions> | ||
<Trigger.ExitActions> | ||
<StopStoryboard BeginStoryboardName="BeginStoryboardCloseStoryboard" /> | ||
</Trigger.ExitActions> | ||
</Trigger> | ||
<Trigger Property="IsMouseOver" Value="True"> | ||
<Setter TargetName="PART_Border" Property="BorderBrush" Value="{DynamicResource WD.PrimaryNormalSolidColorBrush}" /> | ||
</Trigger> | ||
<Trigger SourceName="PART_Popup" Property="AllowsTransparency" Value="True"> | ||
<Setter TargetName="PART_DropDownBorder" Property="Margin" Value="0,2,0,0" /> | ||
</Trigger> | ||
<Trigger Property="SelectedTime" Value=""> | ||
<Setter TargetName="PART_Watermark" Property="Visibility" Value="Visible" /> | ||
</Trigger> | ||
<Trigger Property="SelectedTime" Value="{x:Null}"> | ||
<Setter TargetName="PART_Watermark" Property="Visibility" Value="Visible" /> | ||
</Trigger> | ||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<Style BasedOn="{StaticResource WD.TimeSelector}" TargetType="{x:Type controls:TimeSelector}" /> | ||
<Style BasedOn="{StaticResource WD.TimePicker}" TargetType="{x:Type controls:TimePicker}" /> | ||
|
||
</ResourceDictionary> |