We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Cannot Change The Color of Disabled SFNumericUpDown

i have created a custom SFNumericUpDown with a bindable proprety called DisabledColor

       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);


and in my android render 


[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();
                }
            }
        }
    }
}



but the problem  when I Disable the NumericUPdown  the color turn in gray.


Any way to change the color of disabled NumericUPdown  Control?

1 Reply

PA Paul Anderson S Syncfusion Team November 29, 2018 01:09 PM UTC

Hi Mohamed, 
 
Greetings from Syncfusion. 
 
We have prepared the sample based on your provided code snippet. TextColor is updated properly based on IsEnabled property. Can you please check with the sample in the following location? 
 
 
Regards, 
Paul Anderson 


Loader.
Live Chat Icon For mobile
Up arrow icon