All the controls missing in WPF. Over 1 million downloads.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

288 lines
15 KiB

<!--***********************************************************************************
Toolkit for WPF
Copyright (C) 2007-2020 Xceed Software Inc.
This program is provided to you under the terms of the XCEED SOFTWARE, INC.
COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
https://github.com/xceedsoftware/wpftoolkit/blob/master/license.md
For more features, controls, and fast professional support,
pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
**********************************************************************************-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit"
xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes"
xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes"
xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<!-- =============================================================================== -->
<!-- ResourceDictionary for TimePicker and related controls -->
<!-- =============================================================================== -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\Themes\Generic\Glyphs.xaml" />
</ResourceDictionary.MergedDictionaries>
<conv:InverseBoolConverter x:Key="InverseBoolConverter" />
<conv:ObjectTypeToNameConverter x:Key="ObjectTypeToNameConverter" />
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<DataTemplate x:Key="DefaultWatermarkTemplate">
<ContentControl Content="{Binding}"
Foreground="Gray"
Focusable="False"
Margin="0,0,3,0" />
</DataTemplate>
<LinearGradientBrush x:Key="PopupDarkBorderBrush"
EndPoint="0.5,1"
StartPoint="0.5,0">
<GradientStop Color="#FFA3AEB9"
Offset="0" />
<GradientStop Color="#FF8399A9"
Offset="0.375" />
<GradientStop Color="#FF718597"
Offset="0.375" />
<GradientStop Color="#FF617584"
Offset="1" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="PopupBackgroundBrush"
StartPoint="0,0"
EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Offset="0"
Color="#FFffffff" />
<GradientStop Offset="1"
Color="#FFE8EBED" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<Style x:Key="TimePickerToggleButtonStyle"
TargetType="ToggleButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid SnapsToDevicePixels="True">
<chrome:ButtonChrome x:Name="ToggleButtonChrome"
CornerRadius="0,2.75,2.75,0"
RenderChecked="{Binding IsOpen, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TimePicker}}"
RenderEnabled="{Binding IsEnabled, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TimePicker}}"
RenderMouseOver="{TemplateBinding IsMouseOver}"
RenderPressed="{TemplateBinding IsPressed}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
</chrome:ButtonChrome>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="ListItemHover"
Color="#FFE7F5FD" />
<Style x:Key="TimeItemStyle"
TargetType="ListBoxItem">
<Style.Setters>
<Setter Property="Padding"
Value="4" />
</Style.Setters>
<Style.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Background"
Value="{StaticResource ListItemHover}" />
</Trigger>
</Style.Triggers>
</Style>
<!-- =============================================================================== -->
<!-- TimePicker -->
<!-- =============================================================================== -->
<Style TargetType="{x:Type local:TimePicker}">
<Setter Property="Background"
Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
<Setter Property="BorderThickness"
Value="1,1,0,1" />
<Setter Property="BorderBrush"
Value="{DynamicResource {x:Static themes:ResourceKeys.ControlNormalBorderKey}}" />
<Setter Property="IsTabStop"
Value="False" />
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment"
Value="Right" />
<Setter Property="VerticalContentAlignment"
Value="Center" />
<Setter Property="TextAlignment"
Value="Right" />
<Setter Property="WatermarkTemplate"
Value="{StaticResource DefaultWatermarkTemplate}" />
<Setter Property="ButtonSpinnerUpContentTemplate"
Value="{StaticResource IncreaseGlyphNormalKey}" />
<Setter Property="ButtonSpinnerDownContentTemplate"
Value="{StaticResource DecreaseGlyphNormalKey}" />
<Setter Property="ButtonSpinnerUpDisabledContentTemplate"
Value="{StaticResource IncreaseGlyphDisabledKey}" />
<Setter Property="ButtonSpinnerDownDisabledContentTemplate"
Value="{StaticResource DecreaseGlyphDisabledKey}" />
<Setter Property="DropDownButtonContent"
Value="{StaticResource DropDownArrowGlyph}" />
<Setter Property="DropDownButtonDisabledContent"
Value="{StaticResource DropDownDisabledArrowGlyph}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:TimePicker}">
<Grid x:Name="root">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<local:ButtonSpinner x:Name="PART_Spinner"
IsTabStop="False"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
SpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"
SpinnerWidth="{TemplateBinding ButtonSpinnerWidth}"
SpinnerHeight="{TemplateBinding ButtonSpinnerHeight}"
SpinnerUpContentTemplate="{TemplateBinding ButtonSpinnerUpContentTemplate}"
SpinnerDownContentTemplate="{TemplateBinding ButtonSpinnerDownContentTemplate}"
SpinnerUpDisabledContentTemplate="{TemplateBinding ButtonSpinnerUpDisabledContentTemplate}"
SpinnerDownDisabledContentTemplate="{TemplateBinding ButtonSpinnerDownDisabledContentTemplate}"
AllowSpin="{TemplateBinding AllowSpin}"
ShowSpinner="{TemplateBinding ShowButtonSpinner}">
<local:WatermarkTextBox x:Name="PART_TextBox"
BorderThickness="0"
Background="Transparent"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontStretch="{TemplateBinding FontStretch}"
FontStyle="{TemplateBinding FontStyle}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
IsUndoEnabled="{Binding IsUndoEnabled, RelativeSource={RelativeSource TemplatedParent}}"
IsTabStop="True"
MinWidth="20"
AcceptsReturn="False"
Padding="{TemplateBinding Padding}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="NoWrap"
Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}"
TabIndex="{TemplateBinding TabIndex}"
Watermark="{TemplateBinding Watermark}"
WatermarkTemplate="{TemplateBinding WatermarkTemplate}" />
</local:ButtonSpinner>
<ToggleButton x:Name="_timePickerToggleButton"
Grid.Column="1"
Width="{Binding DropDownButtonWidth, RelativeSource={RelativeSource TemplatedParent}}"
Height="{Binding DropDownButtonHeight, RelativeSource={RelativeSource TemplatedParent}}"
Background="White"
Focusable="False"
Content="{Binding DropDownButtonContent, RelativeSource={RelativeSource TemplatedParent}}"
IsChecked="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource TimePickerToggleButtonStyle}"
IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}"
IsEnabled="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}"
Visibility="{TemplateBinding ShowDropDownButton, Converter={StaticResource BooleanToVisibilityConverter}}" >
</ToggleButton>
<Popup x:Name="PART_Popup"
IsOpen="{Binding IsChecked, ElementName=_timePickerToggleButton}"
AllowsTransparency="True"
StaysOpen="False"
ToolTip="{x:Static sys:String.Empty}">
<Popup.Resources>
<Style TargetType="ToolTip">
<Style.Triggers>
<Trigger Property="Content"
Value="{x:Static sys:String.Empty}">
<Setter Property="Visibility"
Value="Collapsed" />
</Trigger>
</Style.Triggers>
</Style>
</Popup.Resources>
<Border BorderThickness="1"
MinWidth="{Binding ActualWidth, ElementName=root}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
Background="{StaticResource PopupBackgroundBrush}"
BorderBrush="{StaticResource PopupDarkBorderBrush}">
<Grid>
<ListBox x:Name="PART_TimeListItems"
BorderThickness="0"
DisplayMemberPath="Display"
ItemContainerStyle="{StaticResource TimeItemStyle}" >
</ListBox>
</Grid>
</Border>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsReadOnly, RelativeSource={RelativeSource Self}}"
Value="False" />
<Condition Binding="{Binding AllowTextInput, RelativeSource={RelativeSource Self}}"
Value="False" />
</MultiDataTrigger.Conditions>
<Setter Property="IsReadOnly"
Value="True"
TargetName="PART_TextBox" />
</MultiDataTrigger>
<DataTrigger Binding="{Binding IsReadOnly, RelativeSource={RelativeSource Self}}"
Value="True">
<Setter Property="IsReadOnly"
Value="True"
TargetName="PART_TextBox" />
</DataTrigger>
<Trigger Property="IsEnabled"
Value="False">
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
<Setter TargetName="_timePickerToggleButton"
Property="Content"
Value="{Binding DropDownButtonDisabledContent, RelativeSource={RelativeSource TemplatedParent}}" />
</Trigger>
<!--ToggleButton can be closed when TimePicker is included in DateTimePicker-->
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding TemplatedParent, RelativeSource={RelativeSource Self}, Converter={StaticResource ObjectTypeToNameConverter}}"
Value="DateTimePicker" />
<Condition Binding="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}}"
Value="True" />
</MultiDataTrigger.Conditions>
<Setter Property="IsHitTestVisible"
Value="True"
TargetName="_timePickerToggleButton" />
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>