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 ElementNamebinding. 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
Navigationcontext in the command method in your viewmodel by writing:Lesson learned.