Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
141184 | Nov 28,2018 04:29 PM UTC | Nov 29,2018 01:09 PM UTC | Xamarin.Forms | 1 |
![]() |
Tags: SfNumericUpDown |
public Color DisabledColor
{
get { return (Color)GetValue(DisabledColorProperty); }
set { SetValue(DisabledColorProperty, value); if (!IsEnabled) TextColor = value; }
}
public static readonly BindableProperty DisabledColorProperty = BindableProperty.Create(nameof(DisabledColor),returnType: typeof(Color),declaringType: typeof(MyNumericUpDown),defaultValue: Color.Black,defaultBindingMode: BindingMode.TwoWay);
[assembly: ExportRenderer(typeof(MyNumericUpDown), typeof(MyNumericUpDownRender))]
namespace Comodor.Droid.CustomConttrols
{
class MyNumericUpDownRender: SfNumericUpDownRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<SfNumericUpDown> e)
{
base.OnElementChanged(e);
if (Control != null)
{
var dp = (MyNumericUpDown)Element;
if (!dp.IsEnabled)
{
Control.TextColor = dp.DisabledColor.ToAndroid();
}
}
}
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
if (e.PropertyName.Equals("IsEnabled"))
{
var dp = (MyNumericUpDown)Element;
if (!dp.IsEnabled)
{
Control.TextColor = dp.DisabledColor.ToAndroid();
}
else
{
Control.TextColor=dp.TextColor.ToAndroid();
}
}
}
}
}
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.