xamarin / SignaturePad

MIT License
245 stars 150 forks source link

IsEnabled does not work as expected in UWP #175

Open aparent-emgs opened 5 years ago

aparent-emgs commented 5 years ago

Description

I have a custom renderer implemented for UWP for a control in my Xamarin.Forms application that uses the SignaturePadCanvasView class as its native control. I want the control to be disabled by default when it is first displayed in the view. The problem I've stumbled upon is that the canvas only seems to be disabled when IsEnabled is changed while the control is being displayed.

You can see the reason why here

        public SignaturePadCanvasView ()
        {
            DefaultStyleKey = typeof (SignaturePadCanvasView);

            IsEnabledChanged += delegate
            {
                var ip = inkPresenter;
                if (ip != null)
                    ip.IsInputEnabled = IsEnabled;
            };
        }

inkPresenter.IsInputEnabled is only mutated when the value of IsEnabled is changed, but it should ideally also be mutated to the current value of IsEnabled as soon as it becomes available, otherwise inkPresenter remains enabled until IsEnabled is set to true, then back to false

Expected Behavior

The control should be disabled if IsEnabled is set to false at instanciation.

Actual Behavior

The control is still enabled.

Basic Information