Forum Xamarin.Forms

Is there a reason I cannot navigate to a new page from a popup?

iooovoltsiooovolts Member ✭✭✭
edited September 2019 in Xamarin.Forms

I am using Rg.plugins.Popup for popups in my Xamarin.Forms application and even though I have registered my View for navigation , when I try to navigate from my popup view to a new page, it just closes and popup and nothing happens. Does anyone have a workaround to this please? Thanks!

Popup View

<popup:PopupPage xmlns=""
    <ScrollView HorizontalOptions="Center"
        <Frame Margin="15"
            <StackLayout IsClippedToBounds="True"
                         Padding="10, 5"
                <Button Text="Edit profile"
                        Command="{Binding NavigateToEditProfileViewCommand}"/>

PopUp ViewModel

public class ProfileOptionsViewModel : BaseViewModel
    private INavigationService _navigationService;
    public DelegateCommand NavigateToEditProfileViewCommand { get; }
    public ProfileOptionsViewModel(INavigationService navigationService)
        _navigationService = navigationService;
        NavigateToEditProfileViewCommand = new DelegateCommand(async () => await _navigationService.NavigateAsync("EditProfileView"));


  • ColeXColeX Member, Xamarin Team Xamurai
    edited September 2019

    I guess you click on the background of the page but not the button , so popupPage closes and nothing happens.

    Add breakPoints on method OnBackgroundClicked in popupPage and the command NavigateToEditProfileViewCommand to see which one is invoked .

  • iooovoltsiooovolts Member ✭✭✭

    @ColeX the button is big and black thanks to Material Visual, I definitely click on the button, and when I set breakpoints it hit my NavigateToEditProfileViewCommand and executes the NavigateAsync code but then nothing happens. Unless I am misunderstanding what you are saying? Thanks.

  • ColeXColeX Member, Xamarin Team Xamurai
    edited September 2019

    Try Prism.Plugin.Popups .

    It provides an extremely lightweight framework for implementing Popup Pages using the Rg.Plugin.Popup package with Prism.Forms and provides extensibility for Prism.Forms INavigationService to handle Popup Views.

  • iooovoltsiooovolts Member ✭✭✭

    Hi @ColeX , that is in fact the package I am using :smile: ! If you have a working project where you can navigate to a whole content page from a popup view that would be most helpful. Maybe I would be able to spot some differences, thanks a lot.

  • HelenMHelenM USMember ✭✭
    edited March 31

    @iooovolts I have exactly the same problem. For some reason it works when I use an abolute uri or set the page to navigate to as the root page, so for example await _navigationService.NavigateAsync("//EditProfileView"); or await _navigationService.NavigateAsync("//HomePage/EditProfileView"); would work but then this causes all sorts of problems for me with displaying alerts & the back button :( Did you find a solution to this?

Sign In or Register to comment.