优化更新代码,添加界面功能并整合
This commit is contained in:
93
WPFluent/Controls/TimePicker/TimePicker.cs
Normal file
93
WPFluent/Controls/TimePicker/TimePicker.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace WPFluent.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a control that allows a user to pick a time value.
|
||||
/// </summary>
|
||||
public class TimePicker : System.Windows.Controls.Primitives.ButtonBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="ClockIdentifier"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ClockIdentifierProperty = DependencyProperty.Register(
|
||||
nameof(ClockIdentifier),
|
||||
typeof(TimeClockIdentifier),
|
||||
typeof(TimePicker),
|
||||
new PropertyMetadata(TimeClockIdentifier.Clock24Hour));
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="Header"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
|
||||
nameof(Header),
|
||||
typeof(object),
|
||||
typeof(TimePicker),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="MinuteIncrement"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty MinuteIncrementProperty = DependencyProperty.Register(
|
||||
nameof(MinuteIncrement),
|
||||
typeof(int),
|
||||
typeof(TimePicker),
|
||||
new PropertyMetadata(1));
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="SelectedTime"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty SelectedTimeProperty = DependencyProperty.Register(
|
||||
nameof(SelectedTime),
|
||||
typeof(TimeSpan?),
|
||||
typeof(TimePicker),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="Time"/> dependency property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TimeProperty = DependencyProperty.Register(
|
||||
nameof(Time),
|
||||
typeof(TimeSpan),
|
||||
typeof(TimePicker),
|
||||
new PropertyMetadata(TimeSpan.Zero));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the clock system to use.
|
||||
/// </summary>
|
||||
public TimeClockIdentifier ClockIdentifier
|
||||
{
|
||||
get => (TimeClockIdentifier)GetValue(ClockIdentifierProperty);
|
||||
set => SetValue(ClockIdentifierProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the content for the control's header.
|
||||
/// </summary>
|
||||
public object Header { get => GetValue(HeaderProperty); set => SetValue(HeaderProperty, value); }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value that indicates the time increments shown in the minute picker. For example, 15 specifies
|
||||
/// that the TimePicker minute control displays only the choices 00, 15, 30, 45.
|
||||
/// </summary>
|
||||
public int MinuteIncrement
|
||||
{
|
||||
get => (int)GetValue(MinuteIncrementProperty);
|
||||
set => SetValue(MinuteIncrementProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time currently selected in the time picker
|
||||
/// </summary>
|
||||
public TimeSpan? SelectedTime
|
||||
{
|
||||
get => (TimeSpan?)GetValue(SelectedTimeProperty);
|
||||
set => SetValue(SelectedTimeProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time currently set in the time picker.
|
||||
/// </summary>
|
||||
public TimeSpan Time { get => (TimeSpan)GetValue(TimeProperty); set => SetValue(TimeProperty, value); }
|
||||
}
|
||||
Reference in New Issue
Block a user