Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageViewContainer prevents App.MainPage change from working #34

Open
therealjohn opened this issue Jan 22, 2016 · 0 comments
Open

PageViewContainer prevents App.MainPage change from working #34

therealjohn opened this issue Jan 22, 2016 · 0 comments

Comments

@therealjohn
Copy link

I've run into a scenario where a Page with a PageViewContainer and a button that calls App.Current.MainPage = new NavigationPage(new MyPage()) does not work. The app appears to not change the MainPage.

However, MainPage is set, and if you minimize the application on iOS, then open it back up it will be correct.

Consider this page:

<ContentPage 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    xmlns:ttc="clr-namespace:TwinTechs.Controls;assembly=TwinTechsForms"
    x:Class="CaseProjectTest.Views.MyPage" 
    Title="My Page">
    <ContentPage.Content>


        <StackLayout>

        <ttc:PageViewContainer>
            VerticalOptions="FillAndExpand"
            HorizontalOptions="FillAndExpand">

            <ttc:PageViewContainer.Content>

                <ContentPage>
                    <Label Text="Page in a Page"></Label>
                </ContentPage>

            </ttc:PageViewContainer.Content>

        </ttc:PageViewContainer>

        <Button Text="Click Me" Command="{Binding NavigateCommand}"/>

    </StackLayout>

    </ContentPage.Content>
</ContentPage>

The button command will cause App.Current.MainPage = new NavigationPage(new MyPageTwo()); to happen. MyPageTwo is just an empty ContentPage. When you press the button, MyPage is still showing. I would expect MyPageTwo to show (within the NavigationPage).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant