Ghost1372

everything can be handy

BreadcrumbPageMappingsGenerator

Use this generator to create a page-mapping dictionary class for JsonNavigationService, and configure it using
.ConfigureBreadcrumbBar(BreadCrumbNav, BreadcrumbPageMappings.PageDictionary).

This generator scans all XAML files and extracts pages that define BreadcrumbNavigator attached properties.

How To Use it?

Just add an AdditionalFiles entry to your .csproj.

1
2
3
<ItemGroup>
<AdditionalFiles Include="**\*.xaml" />
</ItemGroup>

Namespace

You can define your own namespace by adding a property to a PropertyGroup.

1
2
3
<PropertyGroup>
<BreadcrumbMappingsNamespace>MyBreadcrumbMappingsNamespace</BreadcrumbMappingsNamespace>
</PropertyGroup>

Result

The output is a mapping dictionary similar to the following:

1
2
3
4
5
6
7
8
9
10
11
public partial class BreadcrumbPageMappings
{
public static Dictionary<Type, BreadcrumbPageConfig> PageDictionary = new()
{
{typeof(DevWinUIGallery.Views.SettingsPage), new BreadcrumbPageConfig { PageTitle = null, IsHeaderVisible = true, ClearNavigation = false}},
{typeof(DevWinUIGallery.Views.AboutUsSettingPage), new BreadcrumbPageConfig { PageTitle = null, IsHeaderVisible = true, ClearNavigation = false}},
{typeof(DevWinUIGallery.Views.AppUpdateSettingPage), new BreadcrumbPageConfig { PageTitle = null, IsHeaderVisible = true, ClearNavigation = false}},
{typeof(DevWinUIGallery.Views.GeneralSettingPage), new BreadcrumbPageConfig { PageTitle = null, IsHeaderVisible = true, ClearNavigation = false}},
{typeof(DevWinUIGallery.Views.ThemeSettingPage), new BreadcrumbPageConfig { PageTitle = null, IsHeaderVisible = true, ClearNavigation = false}},
};
}
0%