How to navigate page detail of detail page in master detail page

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

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    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...)

  • paraszalariyaparaszalariya USMember ✭✭

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

  • paraszalariyaparaszalariya USMember ✭✭

    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?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    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/#Creating_a_MasterDetailPage

    Detail = new NavigationPage (new MyFirstRegistrationPage ());
    
  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    @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

  • paraszalariyaparaszalariya USMember ✭✭

    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

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    Use

    await Navigation.PushAsync(new musecondregistrationpage());
    

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

  • abraabra ADMember ✭✭✭

    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?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    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());
    
  • paraszalariyaparaszalariya USMember ✭✭

    it is not work with command any other good practice?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

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

  • paraszalariyaparaszalariya USMember ✭✭

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

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    post your code, or a repo on github

  • paraszalariyaparaszalariya USMember ✭✭

    `
    <ContentPage.Resources>



    </ContentPage.Resources>
    <ContentPage.Content>


    <Grid.ColumnDefinitions>

    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>


    </Grid.RowDefinitions>


    <Grid.ColumnDefinitions>



    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>




    </Grid.RowDefinitions>

                        <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());
            }
        }
    

    `

  • paraszalariyaparaszalariya USMember ✭✭

    in NextToServicesCommandMethod method i am navigation to second page .

  • DeepakDYDeepakDY INMember ✭✭

    @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

  • JosFra21JosFra21 Member ✭✭

    @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

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    Don’t use NavigationPage
Sign In or Register to comment.