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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cannot Change The Color of Disabled SFNumericUpDown

Thread ID:

Created:

Updated:

Platform:

Replies:

141184 Nov 28,2018 04:29 PM UTC Nov 29,2018 01:09 PM UTC Xamarin.Forms 1
loading
Tags: SfNumericUpDown
MOHAMED FKI
Asked On November 28, 2018 04:29 PM UTC

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?

Paul Anderson S [Syncfusion]
Replied On 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 


CONFIRMATION

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon