Set BindingContext to ViewModel in XAML on Xamarin.Forms

前端 未结 1 480
心在旅途
心在旅途 2020-11-29 09:29

I want to develop a simple project with Xamarin.Form and MVVM. In my solution (named XamarinPOC) i have (in addition to standard Xamarin.Forms projects) one separate project

1条回答
  •  无人及你
    2020-11-29 09:55

    To bind the view to the viewmodel from Xaml in your case do it like this

    
      
        
      
      
        
    
    

    One side note I noticed is with naming conventions, it is better to put all your ViewModels, even if it is only one viewModel, inside a folder named "ViewModels" So the namespace in your case would be XamarinPOC.ViewModels

    0 讨论(0)
提交回复
热议问题