diff options
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT/StepperControl.xaml.cs')
-rw-r--r-- | Xamarin.Forms.Platform.WinRT/StepperControl.xaml.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/StepperControl.xaml.cs b/Xamarin.Forms.Platform.WinRT/StepperControl.xaml.cs index 49a4632f..bf83bf1d 100644 --- a/Xamarin.Forms.Platform.WinRT/StepperControl.xaml.cs +++ b/Xamarin.Forms.Platform.WinRT/StepperControl.xaml.cs @@ -15,6 +15,8 @@ namespace Xamarin.Forms.Platform.WinRT public static readonly DependencyProperty IncrementProperty = DependencyProperty.Register("Increment", typeof(double), typeof(StepperControl), new PropertyMetadata(default(double), OnIncrementChanged)); + public static readonly DependencyProperty ButtonBackgroundColorProperty = DependencyProperty.Register(nameof(ButtonBackgroundColor), typeof(Color), typeof(StepperControl), new PropertyMetadata(default(Color), OnButtonBackgroundColorChanged)); + public StepperControl() { InitializeComponent(); @@ -44,8 +46,20 @@ namespace Xamarin.Forms.Platform.WinRT set { SetValue(ValueProperty, value); } } + public Color ButtonBackgroundColor + { + get { return (Color)GetValue(ButtonBackgroundColorProperty); } + set { SetValue(ButtonBackgroundColorProperty, value); } + } + public event EventHandler ValueChanged; + static void OnButtonBackgroundColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var stepper = (StepperControl)d; + stepper.UpdateButtonBackgroundColor(stepper.ButtonBackgroundColor); + } + static void OnIncrementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var stepper = (StepperControl)d; @@ -78,6 +92,13 @@ namespace Xamarin.Forms.Platform.WinRT changed(d, EventArgs.Empty); } + void UpdateButtonBackgroundColor(Color value) + { + Windows.UI.Xaml.Media.Brush brush = value.ToBrush(); + Minus.Background = brush; + Plus.Background = brush; + } + void UpdateEnabled(double value) { double increment = Increment; |