feat: fix ampm auto derivation.
This commit is contained in:
@@ -260,6 +260,9 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Focused State -->
|
<!-- Focused State -->
|
||||||
|
<Style Selector="^:focus /template/ Border#Background">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerFocusBorderBrush}" />
|
||||||
|
</Style>
|
||||||
<Style Selector="^:focus-within /template/ Border#Background">
|
<Style Selector="^:focus-within /template/ Border#Background">
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerFocusBorderBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerFocusBorderBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ public class TimePicker : TemplatedControl, IClearControl, IInnerContentControl,
|
|||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
|
Focus(NavigationMethod.Pointer);
|
||||||
_presenter?.SetValue(TimePickerPresenter.TimeProperty, null);
|
_presenter?.SetValue(TimePickerPresenter.TimeProperty, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +171,7 @@ public class TimePicker : TemplatedControl, IClearControl, IInnerContentControl,
|
|||||||
|
|
||||||
private void OnButtonClick(object? sender, RoutedEventArgs e)
|
private void OnButtonClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Focus(NavigationMethod.Pointer);
|
||||||
SetCurrentValue(IsDropdownOpenProperty, !IsDropdownOpen);
|
SetCurrentValue(IsDropdownOpenProperty, !IsDropdownOpen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,6 +246,7 @@ public class TimePicker : TemplatedControl, IClearControl, IInnerContentControl,
|
|||||||
{
|
{
|
||||||
_presenter?.Confirm();
|
_presenter?.Confirm();
|
||||||
SetCurrentValue(IsDropdownOpenProperty, false);
|
SetCurrentValue(IsDropdownOpenProperty, false);
|
||||||
|
TopLevel.GetTopLevel(this);
|
||||||
Focus();
|
Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ public class TimePickerPresenter : TemplatedControl
|
|||||||
_hourSelector?.SetValue(DateTimePickerPanel.ItemFormatProperty, part.ToLower());
|
_hourSelector?.SetValue(DateTimePickerPanel.ItemFormatProperty, part.ToLower());
|
||||||
if (_hourSelector is not null)
|
if (_hourSelector is not null)
|
||||||
{
|
{
|
||||||
_hourSelector.MaximumValue = _use12Clock ? 12 : 23;
|
_hourSelector.MaximumValue = _use12Clock ? 11 : 23;
|
||||||
_hourSelector.MinimumValue = _use12Clock ? 1 : 0;
|
_hourSelector.MinimumValue = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (part[0] == 'm' && !panels.Contains(_minuteSelector))
|
else if (part[0] == 'm' && !panels.Contains(_minuteSelector))
|
||||||
@@ -245,7 +245,7 @@ public class TimePickerPresenter : TemplatedControl
|
|||||||
if (_hourSelector is not null)
|
if (_hourSelector is not null)
|
||||||
{
|
{
|
||||||
var index = _use12Clock ? time.Value.Hours % 12 : time.Value.Hours;
|
var index = _use12Clock ? time.Value.Hours % 12 : time.Value.Hours;
|
||||||
if (index == 0) index = 12;
|
if (_use12Clock && index == 12) index = 0;
|
||||||
_hourSelector.SelectedValue = index;
|
_hourSelector.SelectedValue = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ public class TimePickerPresenter : TemplatedControl
|
|||||||
{
|
{
|
||||||
_hourSelector.ItemFormat = "hh";
|
_hourSelector.ItemFormat = "hh";
|
||||||
_hourSelector.MaximumValue = _use12Clock ? 12 : 23;
|
_hourSelector.MaximumValue = _use12Clock ? 12 : 23;
|
||||||
_hourSelector.MinimumValue = _use12Clock ? 1 : 0;
|
_hourSelector.MinimumValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_minuteSelector is not null)
|
if (_minuteSelector is not null)
|
||||||
|
|||||||
Reference in New Issue
Block a user