96.02 Add Book 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="Book"/>
<Button BackgroundColor="Transparent" Text="L Dialog" Command="{Binding ShowDialogCommand}" CommandParameter="LitBookViewLdlgViewModel" />
<Button BackgroundColor="Transparent" Text="R Page" Command="{Binding NavigateCommand}" CommandParameter="LitBookViewRlistPage" />
<Button BackgroundColor="Transparent" Text="Rd Page" Command="{Binding NavigateCommand}" CommandParameter="LitBookViewRdlistPage" />
<Button BackgroundColor="Transparent" Text="O2m Page" Command="{Binding NavigateCommand}" CommandParameter="LitBookViewO2mPage" />
</StackLayout>
Note
- Here is how to get CommandParameters like [CommandParameter="LitBookViewO2mPage"]
- Under ModelServicesPrismModule-project navigate to RegisterTypes()-method of the ModelServicesPrismModuleModule.cs
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitBook.UserControls.LitBookViewO2mUserControl, ModelServicesPrismModule.Literature.LitBook.ViewModels.LitBookViewO2mViewModel>("LitBookViewO2mUserControl");
...
containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitBook.UserControls.LitBookViewReditUserControl, ModelServicesPrismModule.Literature.LitBook.ViewModels.LitBookViewReditViewModel>("LitBookViewReditUserControl");
...
containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitBook.UserControls.LitBookViewRlistUserControl, ModelServicesPrismModule.Literature.LitBook.ViewModels.LitBookViewRlistViewModel>("LitBookViewRlistUserControl");
...
containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitBook.UserControls.LitBookViewRdlistUserControl, ModelServicesPrismModule.Literature.LitBook.ViewModels.LitBookViewRdlistViewModel>("LitBookViewRdlistUserControl");
...
}
Look for "containerRegistry.RegisterForRegionNavigation" with "...LitBook...".
Rebuild
- PrismDemoApp
- run PrismDemoApp
- In the app click "R Page"-menu item of "Book"-block and add a pair of records
and Edit page
- run android