Search code examples
wpfxamarinxamarin.formsdependency-propertiesproperty-binding

Difference between Xamarin.Forms BindableProperty and WPF DependencyProperty


Having a lot of experience in the WPF developement I'm now trying to create my first Xamarin.Forms application. I recognized that there is some equivalent to the WPF DependencyProperty called BindableProperty. They seem to be quite the same, so my question is:

Are there any key differences between the implementation and behaviour of a Xamarin.Forms BindableProperty compared to a WPF DependencyProperty?


Solution

  • There are a number of guides on this subject already out there.

    From the first link I quote;

    DependencyObject & DependencyProperty

    There are something’s that have simply been implemented under a different name. This is very important as they form the backbone of the binding mechanism. If you’ve done any WPF you’ll no doubt be familiar with DependencyProperty and DependencyObject. You won’t find these in Xamarin Forms because they are called something else. DependencyObject is now BindableObject, and DependencyProperty is now known as BindableProperty. Fundamentally they are the same.

    Not exactly sure on the source, but I reckon he has done some research.

    You could of course check the documentation on both: DependencyProperty, which you probably already know by heart. And the BindableProperty from Xamarin.Forms.

    As you have pointed out in the comments, you are wondering because of the difference in naming. I don't have a source for it on record, but I have read/heard somewhere that they have renamed some stuff to make naming more appropriate for mobile. Also, to prevent people from just copy and pasting WPF layouts into mobile apps and creating horrible user experiences that way.