Xamarin form: How to reference to the parent binding

后端 未结 5 1855
情歌与酒
情歌与酒 2020-12-29 05:42
 
   
      
   

Ass

5条回答
  •  半阙折子戏
    2020-12-29 06:25

    You can bind to an ancestor with a RelativeSource.

    Change this line

    
    

    to this

    
    

    Don't forget to add the xml namespace for viewModel on top of the file:

    xmlns:viewModel="clr-namespace:YourProject.ViewModels"
    

    You can read all about RelativeSource bindings here: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/data-binding/relative-bindings#bind-to-an-ancestor

提交回复
热议问题