The design of my app requires that I have a button in the Flyout Header, a separate view, which navigates to a page
Unlike the flyout items themselves though, when I click on the button, the page loads under the flyout header which stays open
Is there a way to have a button mimic exactly what happens when navigating within the flyout contents themselves?
The page I'm trying to navigate to is registered as a route in AppShell
The code in the view referenced in FlyoutHeader calls it from the button click like so
await Shell.Current.GoToAsync("thepage");
As mentioned above the flyout menu is open at this point in order to access the button but when clicked it loads the desired page but I want it to automatically shut the menu
Is there a way to do this please?
As Ricardo says above.
You can use Shell.Current.FlyoutIsPresented = false;
//===event click or command===
private async void Button_Clicked(object sender, System.EventArgs e)
{
await Shell.Current.GoToAsync($"your others pages route");
Shell.Current.FlyoutIsPresented = false;
}
Related
I am trying to change a button in the side menu drawer, depening on whether the user is logged in or not. I hoped I could simply just check everytime the side menu is opened via the burger icon by overriding OnAppearing():
protected override void OnAppearing()
{
base.OnAppearing();
SetButtonAccordingToPosition();
}
Unfortunately, this function is only called ONCE when the app starts and then never again anymore.
I need to find out when the side menu is visible. How would i do that?
I have a Xamarin.Forms (3.4) app with several Content pages, some of which have several entry boxes. If go to a page, then edit an entry, so far everything is fine. But when I "exit" the page (by doing a Navigation.PopModalAsync() ), and then return to the page, on iOS there is immediately a cursor in the entry, and also the keyboard pops-up. This is not what my user will expect.
On Android, the cursor is in the entry, but it does not pop up the keyboard automatically. This too is not desireable.
For refernce, on UWP it doesn't show focus when returning to the page.
How can I avoid this behavior? Is there a way to have the page "clear" the focus?
You should do something like:
override protected void OnAppearing()
{
entry.Unfocus();
}
I have a tabbed page in my xamarin forms project having 4 tabs. I am opening the tabbed page from the home page(normal content page) and initially showing 2nd tab.
When I click the first tab I need to exit from the tabbed page and show the homepage (previous page) in UI.
How can I do this? Is there any tabbed page events are available?
Yes, you can used the CurrentPageChanged event on TabbedPage.
If you are in a navigation page, you can subscribe and navigate back, but if you just want to replace the top-level page, you can do this:
CurrentPageChanged += (sender, e) =>
{
if (CurrentPage == Children.First())
{
Application.Current.MainPage = {your home page instance};
}
};
I develop a tree view and implement context menus for its items. Right click an item, its context menu pops up. Right click an other item, the old context menu disappears but the new menu doesn't appear. Another right click is required to show the new context menu. Any way to make one right click works in this case? My code to generate the context menu is as below
void MyTreeView::contextMenuEvent(QContextMenuEvent* event) override
{
if (Item* item = itemAt(event->pos())) {
unique_ptr<QMenu> menu(item->createMenu(this));
if (menu && !menu->isEmpty())
menu->exec(event->globalPos());
}
}
I've got an application that allows a panel to popup to allow the user to edit some properties.
How do I set the panel owner so that it is on top of all the other components on the page without actually disabling them like you do with an alert box?
Use the PopUpManager to display something on top of everything else. I used a function like this to create the Popup before:
protected function createPopUp(className:Class):void{
var win : IFlexDisplayObject = PopUpManager.createPopUp(Application.application as DisplayObject, className, false) as IFlexDisplayObject;
PopUpManager.centerPopUp(win);
}
You can see it in action with the Flextras Calendar API Explorer. Click any button on the top bar.