1
votes

I want to know why we can't put in a class C # with Xamarin.forms "BindingContext = this" but we can do it in a content page (class and .Xaml) ?

1
Can you explain your question more, in order to help you we need to know what is your problem so just give us more details.Almir Vuk
there is no problem but I just want to know the difference between class c# and content page when we use the Binding!!why class c# must implement INotifyPropertychanged but when we use a content page we put just bindingContext=this ?Aicha Maghrebi
BindingContext = this would make the content page in question bind to its own properties. If you want to bind the ContentPage to another class (which is basically what MVVM is all about), that class (the DataModel class) must implement INotifyPropertyChanged in order to "tell" the ContentPage what is happening with its values so that the UI can adjust accordingly. Using BindingContext = this isn't actually good practise unless you are creating a custom view you want to consume in other views or pages.Markus Michel

1 Answers

1
votes

It is a good question. Hard to explain that.First,you should understand what Context is.

Context: can be understanded worked with a content page.If have a content page ,there will has a context about it.Rather than why not c# class can not use(bindContext).The Context is connected with the entire life circle of the content page.

Then BindingContext was born to use about content page.

Don't struggle too much,maybe you can refer to the Context explanation of Android Context of Android ,you'll actually find that Context is amazing .But they are the same thing,just for reference only.