Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Custom control: BindableProperty doesn't seems to be bound

Ben.2646Ben.2646 USMember ✭✭


I'm working on a custom control.
This custom control has a "Value" property.
Here is my control cs file:

public partial class Duration : Grid, INotifyPropertyChanged
    public static readonly BindableProperty ValueProperty = BindableProperty.Create("Value", typeof(int), typeof(Duration), default(int), defaultBindingMode: BindingMode.TwoWay);
    public int Value
        get { return (int)GetValue(ValueProperty); }
        set { SetValue(ValueProperty, value); }


And here is my xaml where I use my control (where I make the binding):
<controls:Duration Value="{Binding duration, Mode=TwoWay}"/>

And here is my bound property:

        private int _duration = 6546;
        public int duration
            get { return _duration; }
                if (_duration == value)

                _duration = value;
                RaisePropertyChanged(() => duration);

My problem is that my duration property is never updated. I've added breakpoint (in Visual Studio) and they are never reached.
What's wrong with my ValueProperty ?

Best Answers


Sign In or Register to comment.