You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.0 KiB
44 lines
1.0 KiB
namespace ShoopNCook.Views;
|
|
|
|
public partial class CounterView : ContentView
|
|
{
|
|
public static readonly BindableProperty CountProperty =
|
|
BindableProperty.Create(nameof(Count), typeof(uint), typeof(CounterView), default(uint) + 1);
|
|
|
|
public static readonly BindableProperty CounterTextProperty =
|
|
BindableProperty.Create(nameof(CounterText), typeof(string), typeof(CounterView), default(string));
|
|
|
|
public CounterView()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public uint Count
|
|
{
|
|
get => (uint)GetValue(CountProperty);
|
|
set
|
|
{
|
|
SetValue(CountProperty, value <= 1 ? 1 : uint.Parse(value.ToString()));
|
|
}
|
|
}
|
|
|
|
public string CounterText
|
|
{
|
|
get => (string)GetValue(CounterTextProperty);
|
|
set
|
|
{
|
|
SetValue(CounterTextProperty, value);
|
|
}
|
|
}
|
|
|
|
private void OnPlus(object o, EventArgs e)
|
|
{
|
|
Count += 1;
|
|
}
|
|
|
|
private void OnMinus(object o, EventArgs e)
|
|
{
|
|
Count -= 1;
|
|
}
|
|
}
|