protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
        {
            // NOTE: It is imperative that we set the control prior to the base method so that it can do all of the necessary
            // setup with property bindings. Since we're using a AppCompatButton, we have to mimic the calls that are used
            // in the base method.
            if (this.Control == null)
            {
                var context = this.Context;//.GetAppCompatThemedContext();
                var control = new AppCompatButton(context);
                this.SetNativeControl(control);

                control.SetOnClickListener(ButtonClickListener.Instance);
                control.Tag = this;
                this.SetNativeControl(control);
                control.AddOnAttachStateChangeListener(this);
            }

            base.OnElementChanged(e);
        }
Пример #2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Button> e)
        {
            // NOTE: It is imperative that we set the control prior to the base method so that it can do all of the necessary
            // setup with property bindings. Since we're using a AppCompatButton, we have to mimic the calls that are used
            // in the base method.
            if (this.Control == null)
            {
                var context = this.Context.GetAppCompatThemedContext();
                var control = new AppCompatButton(context);
                this.SetNativeControl(control);

                control.SetOnClickListener(ButtonClickListener.Instance);
                control.Tag = this;
                this.SetNativeControl(control);
                control.AddOnAttachStateChangeListener(this);
            }

            base.OnElementChanged(e);
        }