Browse Source

Add Clear function to Date and Time pickers. (#13082)

* feat: add Clear function to Date and Time pickers.

* feat: update comment wording.

---------

Co-authored-by: rabbitism <dongbin@irihi.tech>
revert-13066-fixes/13064-logical-scrollable
Dong Bin 3 years ago
committed by GitHub
parent
commit
528eb7daec
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/Avalonia.Controls/CalendarDatePicker/CalendarDatePicker.cs
  2. 8
      src/Avalonia.Controls/DateTimePickers/DatePicker.cs
  3. 8
      src/Avalonia.Controls/DateTimePickers/TimePicker.cs

8
src/Avalonia.Controls/CalendarDatePicker/CalendarDatePicker.cs

@ -918,5 +918,13 @@ namespace Avalonia.Controls
{ {
return !string.IsNullOrWhiteSpace(formatString); return !string.IsNullOrWhiteSpace(formatString);
} }
/// <summary>
/// Clear <see cref="SelectedDate"/>.
/// </summary>
public void Clear()
{
SetCurrentValue(SelectedDateProperty, null);
}
} }
} }

8
src/Avalonia.Controls/DateTimePickers/DatePicker.cs

@ -410,5 +410,13 @@ namespace Avalonia.Controls
{ {
SelectedDateChanged?.Invoke(sender, e); SelectedDateChanged?.Invoke(sender, e);
} }
/// <summary>
/// Clear <see cref="SelectedDate"/>.
/// </summary>
public void Clear()
{
SetCurrentValue(SelectedDateProperty, null);
}
} }
} }

8
src/Avalonia.Controls/DateTimePickers/TimePicker.cs

@ -283,5 +283,13 @@ namespace Avalonia.Controls
_popup!.Close(); _popup!.Close();
SetCurrentValue(SelectedTimeProperty, _presenter!.Time); SetCurrentValue(SelectedTimeProperty, _presenter!.Time);
} }
/// <summary>
/// Clear <see cref="SelectedTime"/>.
/// </summary>
public void Clear()
{
SetCurrentValue(SelectedTimeProperty, null);
}
} }
} }

Loading…
Cancel
Save