I need the currently visible ContentPage, that is bind to a viewmodel, as a CommandParameter
for a view model's command.
Like:
<Button Text="Save"
Command="{Binding AddObjectAndClosePage}"
CommandParameter={Binding MyContentPage} />
But Xamarin does not support the ElementName
binding. How can I use now my ContentPage as parameter?
Ok, it was completely my fault. My approach was breaking all rules of the mvvm pattern.
You can access the
Navigation
context in the command method in your viewmodel by writing:Lesson learned.