I'm writing Xamarin application and I found difference between WPF which I cannot cross.
I'm using Xamarin Forms Labs to get Repeater control.
I have a Repeater, which repeats DataTemplate:
<DataTemplate>
<Button Text="{Binding Text}" Command="{Binding CategorySelectedCommand}" />
</DataTemplate>
But i would like to move command execution to my userControl Binding Context.
Normally with WPF it would look like:
Command={Binding ElementName=myUserControl, Path=DataContext.CategorySelectedCommand}
But it does not have ElementName property.
I have found that I could set BindingContext of my button like this:
BindingContext="{x:Reference myUserControl}"
But then I cannot bind Text property to my button's text.
How should I do this?
Source
doesn't work with a DataTemplate. It's a real shame too, makes it difficult to do real MVVM. – MrZander