feat: fix display format change in TimeRangePicker.
This commit is contained in:
@@ -12,9 +12,9 @@
|
|||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<StackPanel HorizontalAlignment="Left">
|
<StackPanel HorizontalAlignment="Left">
|
||||||
<ToggleSwitch Name="needConfirm" Content="Need Confirm" />
|
<ToggleSwitch Name="needConfirm" Content="Need Confirm" />
|
||||||
<!--
|
|
||||||
<TextBlock Text="{Binding #picker.SelectedTime}" />
|
<TextBlock Text="{Binding #picker.SelectedTime}" />
|
||||||
-->
|
|
||||||
<TextBox
|
<TextBox
|
||||||
Name="displayFormat"
|
Name="displayFormat"
|
||||||
Width="300"
|
Width="300"
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
Width="300"
|
Width="300"
|
||||||
InnerLeftContent="Panel Format"
|
InnerLeftContent="Panel Format"
|
||||||
Text="tt HH mm ss" />
|
Text="tt HH mm ss" />
|
||||||
<!--
|
|
||||||
<u:TimePicker
|
<u:TimePicker
|
||||||
Name="picker"
|
Name="picker"
|
||||||
Width="200"
|
Width="200"
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
Width="300"
|
Width="300"
|
||||||
DisplayFormat="{Binding #displayFormat.Text}"
|
DisplayFormat="{Binding #displayFormat.Text}"
|
||||||
PanelFormat="{Binding #panelFormat.Text}" />
|
PanelFormat="{Binding #panelFormat.Text}" />
|
||||||
-->
|
|
||||||
<TextBlock Text="Binding"/>
|
<TextBlock Text="Binding"/>
|
||||||
<u:TimePicker
|
<u:TimePicker
|
||||||
Width="300"
|
Width="300"
|
||||||
|
|||||||
@@ -57,8 +57,22 @@ public class TimeRangePicker : TimePickerBase, IClearControl
|
|||||||
picker.OnSelectionChanged(args));
|
picker.OnSelectionChanged(args));
|
||||||
EndTimeProperty.Changed.AddClassHandler<TimeRangePicker, TimeSpan?>((picker, args) =>
|
EndTimeProperty.Changed.AddClassHandler<TimeRangePicker, TimeSpan?>((picker, args) =>
|
||||||
picker.OnSelectionChanged(args, false));
|
picker.OnSelectionChanged(args, false));
|
||||||
|
DisplayFormatProperty.Changed.AddClassHandler<TimeRangePicker, string?>((picker, args) => picker.OnDisplayFormatChanged(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDisplayFormatChanged(AvaloniaPropertyChangedEventArgs<string?> args)
|
||||||
|
{
|
||||||
|
if (_startTextBox is not null)
|
||||||
|
{
|
||||||
|
SyncTimeToText(StartTime);
|
||||||
|
}
|
||||||
|
if (_endTextBox is not null)
|
||||||
|
{
|
||||||
|
SyncTimeToText(EndTime, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public string? EndWatermark
|
public string? EndWatermark
|
||||||
{
|
{
|
||||||
get => GetValue(EndWatermarkProperty);
|
get => GetValue(EndWatermarkProperty);
|
||||||
|
|||||||
Reference in New Issue
Block a user