BindingContext is a property of BindableObject, and ContentPage is inherit from BindableObject. So you can use the BindingContext in a content page . (ps : you can check the Inheritance relationship by clicking the class ContentPage step by step)
Besides , ordinary classes do not have this property,so we can't put it in a class .
ContentPage is inherited from TemplatPage, TemplatePage is inherited from Page and so on. If you inherit your ordinary class eg. Class.cs with ContentPage then you will be able to use BindingContext.
BindingContext is property to help you deal with data bindings. Some common case is usage of BindingContext when you are developing in MVVM pattern.
Answers
Can You provide any sample of this ?
If you do MVVM BindingContext is used to bind your view-model class to your Layout.
BindingContext
is a property ofBindableObject
, andContentPage
is inherit fromBindableObject
. So you can use theBindingContext
in a content page . (ps : you can check the Inheritance relationship by clicking the classContentPage
step by step)Besides , ordinary classes do not have this property,so we can't put it in a class .
ContentPage is inherited from TemplatPage, TemplatePage is inherited from Page and so on. If you inherit your ordinary class eg. Class.cs with ContentPage then you will be able to use BindingContext.
BindingContext is property to help you deal with data bindings. Some common case is usage of BindingContext when you are developing in MVVM pattern.
Take a look: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/enterprise-application-patterns/mvvm
Take look here : https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.bindableobject.bindingcontext?view=xamarin-forms#Xamarin_Forms_BindableObject_BindingContext
hope it helps,