committed by
Max Katz
4 changed files with 57 additions and 1 deletions
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using Avalonia.Automation.Provider; |
|||
using Avalonia.Controls; |
|||
|
|||
namespace Avalonia.Automation.Peers; |
|||
|
|||
public class DatePickerAutomationPeer : ControlAutomationPeer, IValueProvider |
|||
{ |
|||
public DatePickerAutomationPeer(DatePicker owner) |
|||
: base(owner) |
|||
{ |
|||
} |
|||
|
|||
public bool IsReadOnly => false; |
|||
public new DatePicker Owner => (DatePicker)base.Owner; |
|||
public string? Value => Owner.SelectedDate?.ToString(); |
|||
|
|||
public void SetValue(string? value) |
|||
{ |
|||
if (DateTimeOffset.TryParse(value, out var result)) |
|||
Owner.SelectedDate = result; |
|||
} |
|||
|
|||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Custom; |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using Avalonia.Automation.Provider; |
|||
using Avalonia.Controls; |
|||
|
|||
namespace Avalonia.Automation.Peers; |
|||
|
|||
public class TimePickerAutomationPeer : ControlAutomationPeer, IValueProvider |
|||
{ |
|||
public TimePickerAutomationPeer(TimePicker owner) |
|||
: base(owner) |
|||
{ |
|||
} |
|||
|
|||
public bool IsReadOnly => false; |
|||
public new TimePicker Owner => (TimePicker)base.Owner; |
|||
public string? Value => Owner.SelectedTime?.ToString(); |
|||
|
|||
public void SetValue(string? value) |
|||
{ |
|||
if (TimeSpan.TryParse(value, out var result)) |
|||
Owner.SelectedTime = result; |
|||
} |
|||
|
|||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Custom; |
|||
} |
|||
Loading…
Reference in new issue