locked
How to navigate page detail of detail page in master detail page RRS feed

  • Question

  • User312992 posted

    Hello i am using master detail page in my application now i have following hierarchy

    Master Detail Page -User Registration Step1
    -- User Registration Step2 ---User Registration Step3

    So now i am at User Registration Step1 now i want to navigate to next step (User Registration Step2).how can i navigate in step2 ?? also i want to display back arrow in navigation bar in step2

    Monday, January 1, 2018 12:42 PM

All replies

  • User2148 posted

    I don't understand... MasterDetail has a MasterPage and a DetailPage. Where do you have to use "RegistrationPage"? I think your RegistrationPages should not be in a MasterDetail layout... First, your user should register, then, after a Login, should visualize the MasterDetail

    (this is my opinion...)

    Monday, January 1, 2018 2:05 PM
  • User312992 posted

    right master detail have a master and detail page and my registration page is detail page.

    Monday, January 1, 2018 2:16 PM
  • User312992 posted

    actually it was my appointment registration portion so i need to complete my appointment registration in 3 steps (Location detail,Services and time schedule).is there any other way to create appointment registration in 3 step in master detail page?

    Monday, January 1, 2018 2:20 PM
  • User2148 posted

    if you think your is a good solution, I suggest to set you Detail as a NavigationPage and add to it all your RegistrationPages

    https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/navigation/master-detail-page/#CreatingaMasterDetailPage

    Detail = new NavigationPage (new MyFirstRegistrationPage ());
    
    Monday, January 1, 2018 2:20 PM
  • User2148 posted

    @paraszalariya said: actually it was my appointment registration portion so i need to complete my appointment registration in 3 steps (Location detail,Services and time schedule).is there any other way to create appointment registration in 3 step in master detail page?

    I think it's ok

    Monday, January 1, 2018 2:22 PM
  • User312992 posted

    yes i make it but now i need to navigate on second step(mysecondregistrationpage) then how can i navigate it and also i need to display back icon in navigation bar of second step

    Monday, January 1, 2018 2:35 PM
  • User2148 posted

    Use

    await Navigation.PushAsync(new musecondregistrationpage());
    

    https://developer.xamarin.com/api/member/Xamarin.Forms.INavigation.PushAsync/p/Xamarin.Forms.Page/

    Monday, January 1, 2018 3:26 PM
  • User172554 posted

    Is it possible to have two navigation stacks in one Xamarin.Forms application ? One for the user registration/logon process, and one for the business logic of the application ? The second navigation stack would be active only if the logon was succesful. Any code samples available with such a scenario?

    Monday, January 1, 2018 3:45 PM
  • User2148 posted

    You have one navigation stack in a XF app (or better, it should be 2, one for Modal and one for no-modal pages).

    Do you need a Logon process with a navigationstack? Ok, you can set your MainPage to a NavigationPage and create your Navigation for Login process.

    MainPage = new NavigationPage(new MyFirstLoginPage());
    

    When you have finished your Login process, change your MainPage to a new NavigationStack

    MainPage = new NavigationPage(new MyPageAfterLogin());
    
    Monday, January 1, 2018 3:48 PM
  • User312992 posted

    @AlessandroCaliaro said: Use

    await Navigation.PushAsync(new musecondregistrationpage());

    https://developer.xamarin.com/api/member/Xamarin.Forms.INavigation.PushAsync/p/Xamarin.Forms.Page/

    it is not work with command any other good practice?

    Monday, January 1, 2018 5:02 PM
  • User2148 posted

    with command? Yes, you can add it to a Button click command

    Monday, January 1, 2018 6:43 PM
  • User312992 posted

    yes it works well with Mvvm binding property but not work with button command it throw null exception.

    Monday, January 1, 2018 7:10 PM
  • User2148 posted

    post your code, or a repo on github

    Monday, January 1, 2018 8:19 PM
  • User312992 posted

    `

                        <StackLayout Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
                            <Label Text="Zipcode" FontSize="13"></Label>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="90*"></ColumnDefinition>
                                    <ColumnDefinition Width="10*"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                </Grid.RowDefinitions>
    
                                <CustomControl:ExtendedEntry x:Name="entry_zipcode" HashBorder="True" Maxlength="5" FontSize="13" Placeholder="Enter Zip Code" Grid.Row="0" Grid.Column="0" Text="{Binding Zipcode,Mode=TwoWay}" >
                                    <!--CustomControl:ExtendedEntry.Behaviors>
                                    <Validation:NumberValidationBehavior x:Name="Numbervalidate"></Validation:NumberValidationBehavior>
                                </CustomControl:ExtendedEntry.Behaviors>-->
                                </CustomControl:ExtendedEntry>
    
                                <Image Source="{StaticResource LocationImage}" Aspect="AspectFit" Grid.Row="0" Grid.Column="1">
                                    <Image.GestureRecognizers>
                                        <TapGestureRecognizer Command="{Binding CurrentLocationCommand}"></TapGestureRecognizer>
                                    </Image.GestureRecognizers>
                                </Image>
                            </Grid>
                        </StackLayout>
                        <StackLayout Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3">
                            <Label Text="Appointment Date " FontSize="13"></Label>
                            <DatePicker x:Name="DatePicker"  MinimumDate="{Binding MinimumDate,Mode=TwoWay}" Date="{Binding AppointmentDate}" Format="{Binding DateFormat}"></DatePicker>
                        </StackLayout>
                        <StackLayout Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
                            <Label Text="Appointment Time" FontSize="13"></Label>
                            <TimePicker x:Name="StartTime"  Time="{Binding  AppointmentTime}" Grid.Row="2" Grid.ColumnSpan="2" Grid.Column="1"></TimePicker>
                        </StackLayout>
    
                        <StackLayout Orientation="Horizontal" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" HorizontalOptions="CenterAndExpand" VerticalOptions="Center">
                            <Button x:Name="findTechnician" FontSize="13" Text="Find Technician" Command="{Binding FindTechnicianCommand}" >
                                <Button.Triggers>
                                    <DataTrigger TargetType="Button" Binding="{Binding Source={x:Reference entry_zipcode},Path=Text.Length}" Value="0">
                                        <Setter Property="IsEnabled" Value="False" />
                                    </DataTrigger>
                                </Button.Triggers>
                            </Button>
                        </StackLayout>
                    </Grid>
    
                    <Grid BackgroundColor="White" Margin="10,5,10,10" Padding="10,15,10,10" IsVisible="{Binding IsBusNameVisisble, Mode=TwoWay}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="40*"></ColumnDefinition>
                            <ColumnDefinition Width="55*"></ColumnDefinition>
                            <ColumnDefinition Width="5*"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
    
                        <StackLayout Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"  >
                            <Label Text="Appointment Address" FontSize="13" ></Label>
                            <CustomControl:ExtendedEntry x:Name="entry_Address" FontSize="13" HashBorder="True" Text="{Binding AppointmentAddress,Mode=TwoWay}" HeightRequest="100" Placeholder="Enter Address" Maxlength="250"></CustomControl:ExtendedEntry>
                            <!--<Editor VerticalOptions="FillAndExpand" Text="{Binding AppointmentAddress,Mode=TwoWay}" HeightRequest="100" >
                            </Editor>-->
                        </StackLayout>
                        <StackLayout Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Padding="0,0,0,10">
                            <Label FontSize="12" Text="NOTE : " FontAttributes="Bold"></Label>
                            <Label FontSize="12" Text="Address should be max 250 character"></Label>
                        </StackLayout>
                        <StackLayout Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Padding="0,10,0,10" >
                            <Label Text="Bus Make"></Label>
                            <Picker ItemsSource="{Binding ListBusMakeName}" SelectedIndex="{Binding SelectedBusMakeName, Mode=TwoWay}"></Picker>
                        </StackLayout>
                    </Grid>
                </StackLayout>
    
                <StackLayout Grid.Row="1" Grid.Column="0" IsVisible="{Binding IsPaymentDetail}" Orientation="Horizontal" HorizontalOptions="CenterAndExpand" VerticalOptions="Center" Margin="10,5,10,10" Padding="5,5,5,5" BackgroundColor="White">
                    <Button Text="Next" Command="{Binding NextToServicesCommand}"></Button>
                </StackLayout>
    
            </Grid>
        </ScrollView>
    </ContentPage.Content>
    

    `

    Appointmentrequest.xml.cs

    `[XamlCompilation(XamlCompilationOptions.Compile)] public partial class AppointmentRequest : ContentPage { private INavigation navigation; public AppointmentRequest() { InitializeComponent(); BindingContext = new AppointmentRequestViewModel(this.Navigation); }

    }`
    

    -My Viewmodel (AppointmentRequestViewModel)

    ` private INavigation Navigation; public AppointmentRequestViewModel(INavigation _Navigation) { Navigation = _Navigation; FindTechnicianCommand = new Command(FindTechnicianCommandMethod); NextToServicesCommand = new Command(NextToServicesCommandMethod); CurrentLocationCommand = new Command(CurrentLocationCommandMethod); BindBusMake(); }

    private void NextToServicesCommandMethod(object obj) { try { if (SelectedBusMakeId != 0) { String Code = Zipcode; DateTime AppoiDate = AppointmentDate; TimeSpan AppiTime = AppointmentTime;

                    AppointmentMaster objappointment = new AppointmentMaster();
                    objappointment.ZipCode = Zipcode;
                    objappointment.AppointmentDate = Convert.ToDateTime(AppointmentDate.ToString("MM/dd/yyyy") + " " + AppiTime.ToString());
                    objappointment.BusMakeId = SelectedBusMakeId;
                    objappointment.BusMakeName = ListBusMakeMaster[_SelectedBusMakeName].BusMakeName.ToString();
                    objappointment.Address = AppointmentAddress.ToString();
                    objappointment.CreatedDate = DateTime.Now;
                    objappointment.UpdatedDate = DateTime.Now;
                    objappointment.CreatedBy = Settings.UserId;
                    objappointment.UpdatedBy = Settings.UserId;
                    App.Current.MainPage = new AllBusMaster
                    {
                        Detail = new NavigationPage(new AppointmentStep2(objappointment) { Title = "Appointment Services" })
                        {
                            BarBackgroundColor = Color.FromHex("#d00b01"),
                            BarTextColor = Color.White
                        }
                    };
                    //Navigation.PushAsync();
                }
                else
                {
                    //DialogManager.ShowMessage("Please select busmake", "");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(@"Error : {0}", ex.Message.ToString());
            }
        }
    

    `

    Wednesday, January 3, 2018 4:37 AM
  • User312992 posted

    in NextToServicesCommandMethod method i am navigation to second page .

    Wednesday, January 3, 2018 4:38 AM
  • User343509 posted

    @AlessandroCaliaro said:

    @paraszalariya said: actually it was my appointment registration portion so i need to complete my appointment registration in 3 steps (Location detail,Services and time schedule).is there any other way to create appointment registration in 3 step in master detail page?

    I think it's ok

    It's work form me

    Thursday, June 28, 2018 5:39 AM
  • User366757 posted

    @AlessandroCaliaro said: I don't understand... MasterDetail has a MasterPage and a DetailPage. Where do you have to use "RegistrationPage"? I think your RegistrationPages should not be in a MasterDetail layout... First, your user should register, then, after a Login, should visualize the MasterDetail

    (this is my opinion...)

    @AlessandroCaliaro Do you know how to block a possible back to the Login page? Once I enter to the master detail page, I need to block a posible back to login

    Friday, September 14, 2018 5:10 PM
  • User2148 posted

    Don’t use NavigationPage

    Friday, September 14, 2018 7:31 PM
  • User71951 posted

    Here's how I solved a similar situation

    In the MasterDetailPage.xaml, I set the Detail to an empty Navigation page <MasterDetailPage.Detail> <NavigationPage/> </MasterDetailPage.Detail>

    Then, when navigating, rather then calling the good old, await Navigation.PushAsync(new myPage());

    I do this instead: MasterDetailPage masterDetail = (MasterDetailPage)Application.Current.MainPage; await masterDetail.Detail.Navigation.PushAsync(new myPage());

    Wednesday, August 21, 2019 7:15 PM