Repository navigation
Add new menu
Sichlan edited this page Jan 11, 2022
·
2 revisions
- Create View and ViewModel
- Add DataTemplates to App.xaml:
<DataTemplate DataType="{x:Type viewModels:VIEWMODEL}"> <views:VIEW /> </DataTemplate> - Add page type as enumeration value to ViewType (ViewType.cs)
- Add ViewModel as transient service to AddViewModelsHostBuilderExtensions in region ViewModels:
services.AddTransient<VIEWMODEL>(); - Add creation delegate to AddViewModelsHostBuilderExtensions in region Delegates:
services.AddSingleton<CreateViewModel<VIEWMODEL>>(s => s.GetRequiredService<VIEWMODEL>); - Add creation delegate and entry for the enum value to ApocryphaViewModelFactory
- MENU ONLY - Add menu button for the new page in NavigationBar.xaml:
<RadioButton IsChecked="{Binding CurrentViewModel, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewModels:VIEWMODEL}, Mode=OneWay}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static navigators:ViewType.VIEWMODELENUM}"> <StackPanel Orientation="Horizontal"> <ContentControl Template="{StaticResource PAGEICON}" Width="20" Height="20" VerticalAlignment="Center" Foreground="{StaticResource BrushForeground1}"/> <TextBlock Text="{x:Static res:Localization.PAGENAMERESOURCE}" Margin="10 0 0 0" Visibility="{Binding MenuExpanded, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}" VerticalAlignment="Center" /> </StackPanel> </RadioButton>