I need some help on binding in a TapGestureRecognizer. I have the following code where I create a CollectionView. I create a TapGestureRecognizer in that view and would like the command parameter to the object in the list itself. I can't seem to figure out a way to word the binding in the command parameter to make this happen. I worked around it for the time being by setting the selection mode and using the bound value of "SelectedObject". Ideally, I would like the commandparameter to be the object in the list itself.
Thanks.
<CollectionView x:Name="switchCollection"
ItemsSource="{Binding ShopSwitches}"
ItemsLayout="HorizontalGrid, 4"
SelectedItem="{Binding SelectedSwitch,Mode=TwoWay}"
SelectionMode="Single"
Grid.Column="1"
Grid.Row="1">
<CollectionView.GestureRecognizers>
<TapGestureRecognizer
Command="{Binding OnSwitchTappedCommand}"
CommandParameter="{Binding Source={RelativeSource AncestorType={x:Type BindableObject}}}"
NumberOfTapsRequired="2"/>
</CollectionView.GestureRecognizers>
use this
.represents the current object