75.02 Add Author 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="Author"/>
                    <Button BackgroundColor="Transparent"  Text="L Dialog"  Command="{Binding ShowDialogCommand}" CommandParameter="LitAuthorViewLdlgViewModel" />
                    <Button BackgroundColor="Transparent"  Text="R Page"    Command="{Binding NavigateCommand}" CommandParameter="LitAuthorViewRlistPage" />
                    <Button BackgroundColor="Transparent"  Text="Rd Page"   Command="{Binding NavigateCommand}" CommandParameter="LitAuthorViewRdlistPage" />
                    <Button BackgroundColor="Transparent"  Text="O2m Page"  Command="{Binding NavigateCommand}" CommandParameter="LitAuthorViewO2mPage" />
                </StackLayout>

Note

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

            containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitAuthor.UserControls.LitAuthorViewO2mUserControl, ModelServicesPrismModule.Literature.LitAuthor.ViewModels.LitAuthorViewO2mViewModel>("LitAuthorViewO2mUserControl");
...
            containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitAuthor.UserControls.LitAuthorViewReditUserControl, ModelServicesPrismModule.Literature.LitAuthor.ViewModels.LitAuthorViewReditViewModel>("LitAuthorViewReditUserControl");
...
            containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitAuthor.UserControls.LitAuthorViewRlistUserControl, ModelServicesPrismModule.Literature.LitAuthor.ViewModels.LitAuthorViewRlistViewModel>("LitAuthorViewRlistUserControl");
...
            containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitAuthor.UserControls.LitAuthorViewRdlistUserControl, ModelServicesPrismModule.Literature.LitAuthor.ViewModels.LitAuthorViewRdlistViewModel>("LitAuthorViewRdlistUserControl");
...
        }

Look for "containerRegistry.RegisterForRegionNavigation" with "...LitAuthor...".

Rebuild

  • rebuild
    • PrismDemoApp
  • run PrismDemoApp.Uwp
  • In the app click "R Page"-menu item of "Author"-block and add a pair of records
  • Click "Update"

picture

  • Here is Update form.

picture

  • run PrismDemoApp.Android

picture