How to use x:Name of items in listView at codebehind?

后端 未结 4 1969
情书的邮戳
情书的邮戳 2021-01-24 10:27

Is there any way to use x:Name of the stacklayout in listview at code behind in xamarin.forms?

 

        
4条回答
  •  我在风中等你
    2021-01-24 11:10

    When you define x:Name in Xaml, the relevant variable is defined automatically. So you can just use it as it was defined. Something like:

    // StackLayout btnStack; // no need - it is defined already
    var cnt = btnStack.Children.Count; // should be ok
    

    Probably your problem is that in the line:

     
    

提交回复
热议问题