Files
Common-VS2019/SacsStandardMob/Mobile/Forms/Controls/SaxTimePicker.cs
T
2021-05-05 15:36:28 +01:00

54 lines
1.8 KiB
C#

using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using Xamarin.Forms;
namespace Sarand.Net.Standard.Mobile.Forms.Controls
{
//=======================================================================
public class SaxTimePicker : TimePicker
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
public SaxTimePicker ()
{
DefaultFontSize = FontSize;
Format = "HH:mm";
}
//-------------------------------------------------------------------
// Properties.
public String FormattedTime { get { return DateUtil.Format(DateTime.Today + Time, Format); } }
// Styling.
public double DefaultFontSize { get; }
//-------------------------------------------------------------------
// C o n t r o l E v e n t s
//-------------------------------------------------------------------
public class TimeChangedEventArgs : EventArgs { };
public event EventHandler<TimeChangedEventArgs> TimeChanged;
protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null)
{
if (propertyName.EqualsCI(TimePicker.TimeProperty.PropertyName))
{
base.OnPropertyChanged(propertyName);
if (TimeChanged != null) TimeChanged.Invoke(this, new TimeChangedEventArgs());
return;
}
base.OnPropertyChanged(propertyName);
}
//-------------------------------------------------------------------
}
//=======================================================================
}