You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a small issue that has tripped me up before, and which was also reported to me on Twitter. The syntax to get the bindingContext in a list view item's tap handler varies based on the type of element you use. Here's a short example:
<Pageloaded="loaded">
<ListViewitems="{{ myList }}">
<ListView.itemTemplate>
<StackLayout>
<Buttontap="buttonTap"text="Hi, I'm a button" />
<Labeltap="labelTap"text="Hi, I'm a label" />
</StackLayout>
</ListView.itemTemplate>
</ListView>
</Page>
The thing to notice here is that buttonTap uses args.object.bindingContext, whereas labelTap uses args.view.bindingContext to get a reference to the same data.
It seems like the API should be the same regardless of what type of UI component you use. A consistent approach would also make it far easier to share code.
The text was updated successfully, but these errors were encountered:
This comes from the fact that the Button tap is event while the Label tap is gesture. We realized that both APIs can be merged and this is already done in our 1.4 release.
Can you try args.object.bindingContext for the Label if you use 1.4?
This is a small issue that has tripped me up before, and which was also reported to me on Twitter. The syntax to get the
bindingContext
in a list view item'stap
handler varies based on the type of element you use. Here's a short example:The thing to notice here is that
buttonTap
usesargs.object.bindingContext
, whereaslabelTap
usesargs.view.bindingContext
to get a reference to the same data.It seems like the API should be the same regardless of what type of UI component you use. A consistent approach would also make it far easier to share code.
The text was updated successfully, but these errors were encountered: