35.02 Add Country to navigation bar (Xamarin) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

  • Open "Views\MainFlyoutPage.xaml"-file of the PrismDemoApp-project
  • Modify content of StackLayout as shown:
                <StackLayout Padding="20" >
...
                    <Label Text="Country"/>
                    <Button BackgroundColor="Transparent"  Text="L Dialog"  Command="{Binding ShowDialogCommand}" CommandParameter="LitCountryViewLdlgViewModel" />
                    <Button BackgroundColor="Transparent"  Text="R Page"    Command="{Binding NavigateCommand}" CommandParameter="LitCountryViewRlistPage" />
                    <Button BackgroundColor="Transparent"  Text="Rd Page"   Command="{Binding NavigateCommand}" CommandParameter="LitCountryViewRdlistPage" />
                    <Button BackgroundColor="Transparent"  Text="O2m Page"  Command="{Binding NavigateCommand}" CommandParameter="LitCountryViewO2mPage" />
                </StackLayout>

Note

  • Here is how to get CommandParameters like [CommandParameter="LitCountryViewO2mPage"]
    • Under ModelServicesPrismModule-project navigate to RegisterTypes()-method of the ModelServicesPrismModuleModule.cs
        public void RegisterTypes(IContainerRegistry containerRegistry)
        {

            containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitCountry.UserControls.LitCountryViewO2mUserControl, ModelServicesPrismModule.Literature.LitCountry.ViewModels.LitCountryViewO2mViewModel>("LitCountryViewO2mUserControl");
...
            containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitCountry.UserControls.LitCountryViewReditUserControl, ModelServicesPrismModule.Literature.LitCountry.ViewModels.LitCountryViewReditViewModel>("LitCountryViewReditUserControl");
...
            containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitCountry.UserControls.LitCountryViewRlistUserControl, ModelServicesPrismModule.Literature.LitCountry.ViewModels.LitCountryViewRlistViewModel>("LitCountryViewRlistUserControl");
...
            containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitCountry.UserControls.LitCountryViewRdlistUserControl, ModelServicesPrismModule.Literature.LitCountry.ViewModels.LitCountryViewRdlistViewModel>("LitCountryViewRdlistUserControl");
...
        }

Look for "containerRegistry.RegisterForRegionNavigation" with "...LitCountry...".

Rebuild

  • rebuild
    • PrismDemoApp
  • run PrismDemoApp.Android
  • In the app click "R Page"-menu item of "Country"-block and add a pair of records

picture

or UWP

picture