uno.extensions icon indicating copy to clipboard operation
uno.extensions copied to clipboard

Enhance BreadcrumbBar with route-aware Attached Property

Open eriklimakc opened this issue 5 months ago • 0 comments

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;
            }
        }
    }
}

eriklimakc avatar Aug 29 '24 11:08 eriklimakc