Context
I am using the ExrinSampleMobileApp from the Exrin repository. When I show the the navigation drawer with swipe, the drawer shows correctly. When I click on the Settings navigation, (after I corrected the MenuOperation to return new NavigationResult(Stacks.Main, Main.Settings);
it navigates correctly, but the drawer remains on top.
I know that the Xamarin MasterDetailPage's IsPresented should be set false to hide the drawer. I also discovered that for this purpose there is an abstraction IMasterDetailContainer which provides a property (also called IsPresented) for this reason.
Question
However there are questions: Where and when to set this property to false and how to access it (I mean how to access to the IMasterDetailContainer implementor?)
After I can not figure out all the details and can not add the Completed Autofac builder the IMasterDetailContainer implementation, I decided to pass via a static reference just try if it works. Unfortunately does not, see the source code with comments:
// Note: This code from the otherwise unchanged ExrinSampleMobileApp from the Exrin repository
public class MenuOperation : ISingleOperation
{
public static IMasterDetailContainer Mdc;
private IMasterDetailContainer _masterDetailContainer;
public MenuOperation(IMasterDetailContainer masterDetailContainer)
{
_masterDetailContainer = masterDetailContainer;
}
public Func<object, CancellationToken, Task<IList<IResult>>> Function
{
get
{
return (parameter, token) =>
{
// _masterDetailContainer = false
// Shame, but no DI worked, so this is only for diagnostics (static):
// This set really false, however the drawer remains and navigation freezed.
Mdc.IsPresented = false;
return new NavigationResult(Stacks.Main, Main.Settings);
// Original navigation was:
//return new NavigationResult(Containers.Main, Regions.Main, Stacks.Second, Second.Detail);
};
}
}
The best way I have found to do this, is to modify the NavigationProxy, on PushAsync and PopAsync. Replace them with this, and modify as necessary.