Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

getting white screen while navigate to another page

HarshitaHarshita INMember ✭✭✭✭

while navigating a page to another page sometime content page showing white screen, after rotate my device then content appears

how to solve this in my xamarin forms app?

Answers

  • CharwakaCharwaka INMember ✭✭✭✭✭

    @Harshita said:
    while navigating a page to another page sometime content page showing white screen, after rotate my device then content appears

    how to solve this in my xamarin forms app?

    How your Navigating , Using any Framework ? and you set your MainPage in App.Xaml.cs Page

  • HarshitaHarshita INMember ✭✭✭✭
    edited February 2018

    @Charwaka
    I am using master details page, happens only master details detail page(navigating from master details menus)

  • CharwakaCharwaka INMember ✭✭✭✭✭

    @Harshita said:
    @Charwaka
    I am using master details page, happens only master details detail page(master details detail page)

    are you using any mvvm framework like freshmvvm,prism,cross ? if no->show me your code how your navigation from master to DetailPage ?

  • HarshitaHarshita INMember ✭✭✭✭

    I am not using freshmvvm,
    here is my code
    in XAML(master details page)

    <MasterDetailPage.Master>
            <ContentPage BackgroundColor="White" Title="MasterPage">
                <ContentPage.Content>
                    <StackLayout>
                        <!--MasterPage Logo-->
                        <StackLayout Padding="20" BackgroundColor="#6786C1">
                            <Image Source="logo2.png" x:Name="MasterDetalsPageMenuLogo" HeightRequest="35" WidthRequest="50"/>
                        </StackLayout>
                        <!--MasterPage Menu-->
                        <StackLayout>
    
                            <ListView x:Name="MenuList" ItemSelected="ItemTapped">
                                <ListView.ItemTemplate>
                                    <DataTemplate>
                                        <ViewCell Height="30">
                                            <ContentView Padding="10,10">
                                                <StackLayout Spacing="0" Orientation="Horizontal">
                                                    <Image Source="{Binding iconSrc}" HeightRequest="30" WidthRequest="30" />
                                                    <Label Text="{Binding MenuName}" VerticalOptions="Center" HorizontalOptions="StartAndExpand" HeightRequest="30" />
                                                </StackLayout>
                                            </ContentView>
                                        </ViewCell>
                                    </DataTemplate>
                                </ListView.ItemTemplate>
                            </ListView>
                        </StackLayout>
                        <!--<Label x:Name="version" HorizontalOptions="EndAndExpand" VerticalOptions="EndAndExpand" TextColor="#6786C1" FontSize="Small"/>-->
                    </StackLayout>
                </ContentPage.Content>
            </ContentPage>
        </MasterDetailPage.Master>
    

    in code behind :

    ObservableCollection<MenuListView> menu = new ObservableCollection<MenuListView>();
    
                    menu.Add(new MenuListView { MenuName = "menu1", MenuPage = "menu1", iconSrc = "ListIcon.png" });
                    menu.Add(new MenuListView { MenuName = "menu2", MenuPage = "menu2", iconSrc = "AddIcon.png" });
                    menu.Add(new MenuListView { MenuName = "menu3", MenuPage = "menu3", iconSrc = "summaryIcon.png" });
    
                    MenuList.ItemsSource = menu;
    
    
     private void ItemTapped(object sender, SelectedItemChangedEventArgs e)
            {
                try
                {
    
                    MenuListView menu = (MenuListView)e.SelectedItem;
                    if (menu.MenuPage == "menu1")
                    {                   
    
                            Detail = new NavigationPage(new menu1(null, false)) { BarBackgroundColor = Color.FromHex("#6786C1"),            BarTextColor = Color.White };
    
                    }
                    else if (menu.MenuPage == "menu2")
                    {
    
                            Detail = new NavigationPage(new menu2()) { BarBackgroundColor = Color.FromHex("#6786C1"), BarTextColor =            Color.White };
    
                    }
                    else if (menu.MenuPage == "menu3")
                    {
    
                            Detail = new NavigationPage(new menu3()) { BarBackgroundColor = Color.FromHex("#6786C1"), BarTextColor =            Color.White };
    
                    }
    
                    IsPresented = false;
                }
                catch (Exception ex)
                {
                    var msg = ex.Message;
                }
    
    }
    
  • CharwakaCharwaka INMember ✭✭✭✭✭

    @Harshita

    this is somewhat fine , have you tried to debug it , need more details when your exactly getting this , let say like after i kill and open app Freshly at time it is coming ?

  • HarshitaHarshita INMember ✭✭✭✭
    edited February 2018

    it not happen while open the app first time,I debug this code, but unable to find any solution,sometimes it showing white screen(not all time) :(

  • AnupKurugod.2101AnupKurugod.2101 USMember
    edited June 2018

    @Charwaka yes when i kill the app and run without debugging it run's fine and at logout i'm getting white screen when im redirecting to loginviewmodel

  • Rohit_ArnavRohit_Arnav USMember ✭✭

    post your sample code here @harshit

  • DipenHansawalaDipenHansawala USMember ✭✭

    Any update on this?

    I am not using any framework for page navigation. Still i am facing this issue.

    I think Xamarin community has still not resolve this issue.
    https://github.com/xamarin/Xamarin.Forms/issues/11993

Sign In or Register to comment.