I want to enable and disable the bars and gesture of the master detail page (basically the whole menu) so that the user can't navigate when opening a certain page. I tried using a modal page to achieve this but I really need the toolbar menu of the navigation page.
How can I achieve that?
use IsGestureEnabled
IsGestureEnabled = false;
Setting the IsGestureEnabled property of the MasterDetailPage to true in the OnAppearing event and false in the OnDisappearing event of each DetailPage, seems giving the expected results.
if IsGestureEnabled = false; Property is working in Android. But not in iOS.you could use CustomRenderer ,you could refer to the workaround
Related
I have a Xamarin Forms application, which has 2 buttons on the toolbar. Currently I'm using FreshMVVM (and it's navigation). I want to load pages without putting them into the navigation. I do not want to have the 'back' button on the toolbar, also I do not want the user return the last page.
Here's how I push a page currently:
CoreMethods.PushPageModel<FirstChoicePageModel>();
I tried to push as a modal, but that way the toolbar buttons does not work until I press back. Should I make new navigation containers and switch to them if I push the buttons?
It's been a little while since I've used FreshMVVM, but if I recall correctly, you have 2 options:
If you want to completly reset the nav stack, you can do CoreMethods.PushPageModelWithNewNavigation<FirstChoicePageModel>();
If you want to keep the nav stack, you can set NavigationPage.SetHasBackButton(this, false); in the code behind of the view.
For both of these options, it may necessary to intercept the back button on Android. In the code behind there is an overrideable method:
protected override bool OnBackButtonPressed()
{
return true; // prevent Xamarin.Forms from processing back button
}
If you want to show a page, but you doesn't want to navigate (change the current page), you can always use Popups.
See this link https://github.com/rotorgames/Rg.Plugins.Popup
I'm trying to disable my bottom navigation view in my activity but it didn't work. But when i try to hide it and show it, its worked fine. But to disable and enable it, it doesn't work. Btw I used android.support.design.widget.BottomNavigationView
This is the code i tried
BottomNavigationView bottomNavView = FindViewById<BottomNavigationView>(Resource.Id.bottom_navigation);
bottomNavView.Enable = true;
its not working and i don't know why :/
I am using NavigationView but I saw the same methods on BottomNavigationView (I declared it on my code). To disable the item you can do this:
navigationView = FindViewById<NavigationView>(Resource.Id.nav_view);//My navigationview
IMenuItem asd = (IMenuItem)navigationView.Menu.GetItem(2);
asd.SetEnabled(false);
If you want to remove items you can do this:
navigationView.Menu.RemoveItem(Resource.Id.nav_Cambiar_TPK);
navigationView.Menu.RemoveItem(Resource.Id.nav_nuevo);
So, I am am able to disable the Close button on a docked form on DockPanel-Suite and I am wondering if it would be possible to disable the Auto-Hide button as well. Basically, I am trying to avoid any user to make changes to the layout of the forms on the dock panel. I am able to disable to the close button by this code.
CloseButton = false;
CloseButtonVisible = false;
Is there a similar property that can allow me to disable Auto-Hide button?
If you check pull request #428 at GitHub repo, you can see a proposed commit.
However, my personal opinion is that supporting such magic switches is too much for a project like this. People who don't want certain elements should derive a new theme from existing ones, and manually removing them.
I am working on Xamarin forms shared project with a master detail page. When I run the app the master detail page is the first item that loads yet it shows the back button which once clicked opens the navigation (master) drawer. This makes no navigation sense whatsoever! I have tried to hide the back button but have not been able to do this. Has anyone come across this and succeeded in doing this? I would prefer a programmatical solution rather than a xaml one.
I have tried adding the below code:
NavigationPage.SetHasBackButton(this, false);
But this doesn't work. I want to keep the toolbar as I will be adding my own menu items here but want the back button gone.
Try this:
NavigationPage.SetBackButtonTitle(this, string.Empty);
NavigationPage.SetHasBackButton(this, false);
I want to display a PopUp in my C# universal app like this :
but the problem,is that my PopUp deosn't work like this Frame that appears in the Groove App,per example,what I want is when I click on a button in the MainPage, it displays the PopUp then to disable the click on any element in the MainPage,the focus will be only on the elements of the Popup until the close of this PopUp
is this possible??
thanks for help
What you want is a modal window, for example you can create one with Content dialog.
ContentDialog modalWindow = new ContentDialog()
{
Title = "youTitle",
Content = "Content",
PrimaryButtonText = "
};
await modalWindow.ShowAsync();
You can show more here
Actually, the "PopUp" you've seen in the Groove App is not a Popup. It's a AccountsSettingsPane. This class provides methods to show the accounts pane and also to enable the app to register callbacks when the accounts flyout is about to be displayed. For more information, please refer to the official Web account management sample in GitHub and especially the Single Microsoft Account scenario in this sample.
When using AccountsSettingsPane, if we use the ProcessMonitor to track this UI, we will find that it is a system app C:\Windows\SystemApps\Microsoft.AccountsControl_cw5n1h2txyewy. What happened here is similar to this case: UWP Modal Window. So you can refer to Launch an app for results to implement this behavior. But this requires you to create another app.
For ContentDialog, it can not be movable. If your content is not complex, you can try with MessageDialog class. This dialog is movable. For more info, please refer to Message dialog sample.