I'm trying to bind my ListView Item to Command from my parent ViewModel. The problem is that I would like to add CommandParameter with current Item
Basically, in WPF i would do something like
<MyItem Command="{Binding ElementName=parent", Path=DataContext.MyCommand}" CommandParameter="{Binding}"/>
In Xamarin Forms ElementName is not working, so the way is to use BindingContext, but how I should use it (if one of my binding points to parent, second one to self)?
I have tried
<MyItem Command="{Binding BindingContext.RemoveCommand, Source={x:Reference parent}}" CommandParameter="{Binding }" />
But it does not work (seems it not changing Source).
I know, that with normal binding a way is to use BindingContext="{x:Reference parent}", but it won't work in this example, because I need Self binding for CommandParameter
How can i do it?
Parentproperty on your binding context and callRemoveCommandon that? Like:Command="{Binding Parent.RemoveCommand}"? You don't want to call the command on the UI element (that's whatx:Referenceis for). The sender of the command will be the current element, so no need to use a parameter here. - Krumelur