uno.extensions
uno.extensions copied to clipboard
Enhance BreadcrumbBar with route-aware Attached Property
What would you like to be added:
To improve the integration of breadcrumb navigation within our application, we need to extend the BreadcrumbBar control by introducing an attached property. This property will automatically track the Navigator's current route and update the breadcrumb navigation dynamically.
More info
private void RouteChanged(object? sender, RouteChangedEventArgs e)
{
if (e.Navigator is FrameNavigator navigator)
{
if (navigator.FullRoute is { } fullRoute)
{
var paths = fullRoute.Path?.Split('/', StringSplitOptions.RemoveEmptyEntries).ToList();
if (fullRoute.Base is { Length: > 0 })
{
paths?.Insert(0, fullRoute.Base);
}
if (paths is { Count: > 0 })
{
Breadcrumbs = paths;
}
}
}
}