Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Why is OnElementPropertyChanged not called on ViewRenderer

$
0
0

I've derived a CustomPicker from Picker and added some bindable properties like

public class CustomPicker : Picker
{
    public static readonly BindableProperty PickerTextColorProperty = BindableProperty.Create("PickerTextColor", typeof(Color), typeof(CustomPicker), Color.Default);
    public Color PickerTextColor
    {
            get { return (Color)GetValue(PickerTextColorProperty); }
            set { SetValue(PickerTextColorProperty, value); }
    }
}

I've made a custom iOS renderer like

[assembly:ExportRenderer(typeof(CustomPicker), typeof(CustomPickerRenderer))]
namespace MyApp
{
        public class CustomPickerRenderer : ViewRenderer<CustomPicker, UIResponderButton>
        {
            ..
        }
}

I'm listning on the properties change with

protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
    base.OnElementPropertyChanged(sender, e);
    ..
}

But the code is not triggered for the new CustomPicker properties. Only for the derived Picker properties.

Anyone got an idea why?

I'm using version 1.2.3


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>