Search code examples
xamarinxamarin.formsmodal-dialogtoolbar

Show modal page on only a portion of the screen


I am developing an iPad app using Xamarin.Forms. I would like my settingspage to be modal so it lay over the previous page like a popup.

I have been trying all solutions I could find and most of them seems to recommend me to call this from a button:

await Navigation.PushModalAsync(ModalSettingsPage);

What happens when I use it is that my settingspage comes in from below as a modal page but not as a popup, it covers the entire screen.

This is my current code:

 //Setup button (action bar)
            ToolbarItems.Add(new ToolbarItem
            {
                // Text = "Setup",
                Icon = "settings1.png",
                Order = ToolbarItemOrder.Default,
                Command = new Command(() => Navigation.PushModalAsync(new ModalSettingsPage())) //Action to perfome on click , open modal view
            });

Also, does anyone now if there is any good way to positions the ToolbarItems? I have two items and would like each one to be positioned at each side, but by default they are both positioned to the right.


Solution

  • There is nothing pre-made in Forms to give you a popup like I think you want. Instead, you would have to create this or use a third-party solution. For example, here is a "popup" implementation that might work for you.