Skip to content
\n

The Command is coming from the page's ViewModel, whereas the CommandParameter from the data that is passed to the DataTemplate . Therefore, I can't just set x:DataType on TapGestureRecognizer, because the parameters have different contexts. Does anyone know how to solve this?

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"
\n

@MitchBomcanhao the missing knowledge how to do that! would you be so kind to show me an example?

\n
\n

I'd just do something like

\n
<TapGestureRecognizer Command=\"{Binding BindingContext.AutomationSelectedCommand, Source={x:Reference Page}}, x:DataType=morestuff:heretoo\"\n      CommandParameter=\"{Binding ., x:DataType=stuff:here}\" />\n
\n

that's how it is working on my app

","upvoteCount":0,"url":"https://github.com/dotnet/maui/discussions/30374#discussioncomment-13660344"}}}

How to set different x:DataType on TapGestureRecognizers with Command from PageViewModel and CommandParameter from childviewmodel? #30374

Answered by MitchBomcanhao
borrmann asked this question in Q&A
Discussion options

You must be logged in to vote

@MitchBomcanhao the missing knowledge how to do that! would you be so kind to show me an example?

I'd just do something like

<TapGestureRecognizer Command="{Binding BindingContext.AutomationSelectedCommand, Source={x:Reference Page}}, x:DataType=morestuff:heretoo"
      CommandParameter="{Binding ., x:DataType=stuff:here}" />

that's how it is working on my app

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@borrmann
Comment options

@rokmeglic71
Comment options

@MitchBomcanhao
Comment options

Answer selected by borrmann
@borrmann
Comment options

@rokmeglic71
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants