Home > database >  what is the difference between x:DataType and BindingContext
what is the difference between x:DataType and BindingContext

Time:12-06

I have these values on a xamarin.Form page. Both of them give me intellisense. What would be the scenarios to use either or both of them?

<ContentPage x:DataType="vm:AboutViewModel" >
 <ContentPage.BindingContext>
    <vm:AboutViewModel>
    </vm:AboutViewModel>
 </ContentPage.BindingContext>
</ContentPage>

CodePudding user response:

BindingContext assigns an instance of the specified class at runtime.

x:DataContext is a design time helper that tells Intellisense what the type of the context for a given block of XAML is

  • Related