Forum Xamarin.Forms

How to setup bindingcontext in xaml?

Hello,

I usualy setup the binding in the view in this way:

_viewModel = new UserPageViewModel(mgr);
BindingContext = _viewModel;

What is the same command in the xaml?

The following is not working:

Can someone help?

Tagged:

Best Answer

Answers

  • russferns22russferns22 Member ✭✭
    edited September 2018

    @chris00r add the following lines of code to your views xaml and carry out your binding

    <ContentPage.BindingContext>
        <ViewModel:className/>
    </ContentPage.BindingContext>
    
Sign In or Register to comment.