27.02 Add Edition 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" >
<Button BackgroundColor="Transparent" Text="Home" Command="{Binding NavigateCommand}" CommandParameter="HomePage" />
<Button BackgroundColor="Transparent" Text="Access Denied" Command="{Binding NavigateCommand}" CommandParameter="AccessDeniedPage" />
<Button BackgroundColor="Transparent" Text="Page Not Found" Command="{Binding NavigateCommand}" CommandParameter="PageNotFoundPage" />
<Button BackgroundColor="Transparent" Text="Register User" Command="{Binding NavigateCommand}" CommandParameter="RegisterUserPage" />
<Button BackgroundColor="Transparent" Text="Login User" Command="{Binding NavigateCommand}" CommandParameter="LoginUserPage" />
<Button BackgroundColor="Transparent" Text="Logout User" Command="{Binding NavigateCommand}" CommandParameter="LogoutUserPage" />
<Button BackgroundColor="Transparent" Text="Change Password" Command="{Binding NavigateCommand}" CommandParameter="ChngpswdUserPage" />
<Button BackgroundColor="Transparent" Text="Show Dialog" Command="{Binding ShowDialogCommand}" CommandParameter="MessageDlg" />
<Label Text="Genre"/>
<Button BackgroundColor="Transparent" Text="L Dialog" Command="{Binding ShowDialogCommand}" CommandParameter="LitGenreViewLdlgViewModel" />
<Button BackgroundColor="Transparent" Text="R Page" Command="{Binding NavigateCommand}" CommandParameter="LitGenreViewRlistPage" />
<Button BackgroundColor="Transparent" Text="Rd Page" Command="{Binding NavigateCommand}" CommandParameter="LitGenreViewRdlistPage" />
<Button BackgroundColor="Transparent" Text="O2m Page" Command="{Binding NavigateCommand}" CommandParameter="LitGenreViewO2mPage" />
<Label Text="Edition"/>
<Button BackgroundColor="Transparent" Text="L Dialog" Command="{Binding ShowDialogCommand}" CommandParameter="LitEditionViewLdlgViewModel" />
<Button BackgroundColor="Transparent" Text="R Page" Command="{Binding NavigateCommand}" CommandParameter="LitEditionViewRlistPage" />
<Button BackgroundColor="Transparent" Text="Rd Page" Command="{Binding NavigateCommand}" CommandParameter="LitEditionViewRdlistPage" />
<Button BackgroundColor="Transparent" Text="O2m Page" Command="{Binding NavigateCommand}" CommandParameter="LitEditionViewO2mPage" />
</StackLayout>
Note
- Here is how to get CommandParameters like [CommandParameter="LitEditionViewO2mPage" ]
- Under ModelServicesPrismModule-project navigate to RegisterTypes()-method of the ModelServicesPrismModuleModule.cs
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitEdition.UserControls.LitEditionViewO2mUserControl, ModelServicesPrismModule.Literature.LitEdition.ViewModels.LitEditionViewO2mViewModel>("LitEditionViewO2mUserControl");
...
containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitEdition.UserControls.LitEditionViewReditUserControl, ModelServicesPrismModule.Literature.LitEdition.ViewModels.LitEditionViewReditViewModel>("LitEditionViewReditUserControl");
...
containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitEdition.UserControls.LitEditionViewRlistUserControl, ModelServicesPrismModule.Literature.LitEdition.ViewModels.LitEditionViewRlistViewModel>("LitEditionViewRlistUserControl");
...
containerRegistry.RegisterForRegionNavigation<ModelServicesPrismModule.Literature.LitEdition.UserControls.LitEditionViewRdlistUserControl, ModelServicesPrismModule.Literature.LitEdition.ViewModels.LitEditionViewRdlistViewModel>("LitEditionViewRdlistUserControl");
...
}
Look for "containerRegistry.RegisterForRegionNavigation" with "...LitEdition...".
Rebuild
- rebuild
- PrismDemoApp
- run PrismDemoApp
- In the app click "R Page"-menu item of "Edition"-block and add a pair of records
or UWP