Code Monkey home page Code Monkey logo

xamarin.forms.breadcrumb's Introduction

⚠️ This NuGet/ repo is now in maintenance mode and support will end once xamarin.forms is no longer supported. Bug fixes only.
MAUI repo - https://github.com/IeuanWalker/Maui.Breadcrumb

Xamarin.Forms.Breadcrumb Nuget Nuget

License: MIT Codacy Badge

This is a breadcrumb navigation control that is completely automatic and uses the Navigation stack to get the page titles to generate the breadcrumbs.

The animation for the control is based on this article - A Cool Breadcrumbs Bar with Xamarin Forms Animations…

Basic example Production Example
Example gif Production Example gif

How to use it?

Install the NuGet package into all of your projects

Install-Package Xamarin.Forms.Breadcrumb

For iOS add the following to AppDelegate.cs > FinishedLaunching

BreadcrumbButtonRenderer.Init();

To add to a page the first thing we need to do is tell our XAML page where it can find the Breadcrumb control, which is done by adding the following attribute to our ContentPage:

<ContentPage x:Class="DemoApp.Pages.BasePage"
             xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:breadcrumb="clr-namespace:Breadcrumb;assembly=Breadcrumb"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d">
    <ContentPage.Content>
        ...
    </ContentPage.Content>
</ContentPage>

Next up, just add the breadcrumb control onto that page and you're all set.

<breadcrumb:Breadcrumb Padding="15" VerticalOptions="Start" />

What can I do with it?

Property What it does Extra info
Separator Sets the image source of the separator This allows you to set the separator to FontImageSource, UriImageSource or FileImageSource.
Default is new FontImageSource { Glyph = " / ", Color = Colors.Black, Size = 15, }
FirstBreadcrumb Allows you to override the first breadcrumb and set an image source. F.e. This is usefull if you want the first breadcrumb to be a home icon instead of the default title. Default will be a label like all the other breadcrumbs
ScrollBarVisibility Sets the HorizontalScrollBarVisibility of the scrollview More info here ScrollBarVisibility. Default value is ScrollBarVisibility.Never
FontSize Sets the text font size for the breadcrumb Default value is 15.
Support NamedSize
TextColor Sets the text color for the breadcrumb and seperator A Color object.
Default value is black.
(doesnt include the last breadcrumb)
CornerRadius A CornerRadius object representing each individual corner's radius for each breadcrumb. Uses the CornerRadius struct allowing you to specify individual corners.
Default value is 10.
(doesnt include the last breadcrumb)
BreadcrumbMargin A Thickness object used to define the spacing between the breadcrumb and separators Uses the Thickness struct allowing you to specify left, top, right and bottom margin
BreadcrumbBackgroundColor This is the background color for the individual breadcrumbs A Color object.
Default value is Transparent.
(doesnt include the last breadcrumb)
LastBreadcrumbTextColor Sets the text color for the last breadcrumb A Color object.
Default value is black.
LastBreadcrumbCornerRadius A CornerRadius object representing each individual corner's radius. Uses the CornerRadius struct allowing you to specify individual corners.
Default value is 10.
LastBreadcrumbBackgroundColor Sets the background color of the last breadcrumbs A Color object.
Default value is Transparent.
AnimationSpeed Sets the speed of the animated breadcrumb Default value is 800.
Set to 0 to disable the animation.
IsNavigationEnabled Used to remove the tab gesture from breadcrumbs Default value is True

First breadcrumb customization

You are able to change the first breadcrumb to an Icon, embedded image or url image. It implements the Xamarin.Forms ImageSource object.

<breadcrumb:Breadcrumb Padding="15" VerticalOptions="Start">
    <breadcrumb:Breadcrumb.FirstBreadCrumb>
        <FontImageSource FontFamily="{StaticResource FontAwesome}"
                            Glyph="{x:Static icons:IconFont.Home}"
                            Size="35"
                            Color="Red" />
    </breadcrumb:Breadcrumb.FirstBreadCrumb>
</breadcrumb:Breadcrumb>

Separator customization

You are able to change the separators to an Icon, embedded image or url image. It implements the Xamarin.Forms ImageSource object.

Font - (FontAwesome)

<breadcrumb:Breadcrumb Padding="15" VerticalOptions="Start">
    <breadcrumb:Breadcrumb.Separator>
        <FontImageSource FontFamily="{StaticResource FontAwesome}"
                            Glyph="{x:Static icons:IconFont.ChevronRight}"
                            Size="15"
                            Color="Red" />
    </breadcrumb:Breadcrumb.Separator>
</breadcrumb:Breadcrumb>

Image - URL

<breadcrumb:Breadcrumb Padding="15" VerticalOptions="Start">
    <breadcrumb:Breadcrumb.Separator>
        <UriImageSource Uri="https://cdn.iconscout.com/icon/free/png-256/xamarin-4-599473.png" />
    </breadcrumb:Breadcrumb.Separator>
</breadcrumb:Breadcrumb>

Image - Embedded

<breadcrumb:Breadcrumb Padding="15" VerticalOptions="Start">
    <breadcrumb:Breadcrumb.Separator>
        <FileImageSource File="exampleImage.png" />
    </breadcrumb:Breadcrumb.Separator>
</breadcrumb:Breadcrumb>

xamarin.forms.breadcrumb's People

Contributors

codacy-badger avatar dependabot-preview[bot] avatar fossabot avatar ieuanwalker avatar jtone123 avatar kycuff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

xamarin.forms.breadcrumb's Issues

Breadcrumbs are not visible when used in combination with Prism IInitializeAsync

Hi,

I'm using the breadcrumbs in a Xamarin Forms project that uses the prism framework as an MVVM helper.

When navigating to a Page that uses the IInitializeAsync interface, the breadcrumbs will not be visible. This happens because the moment the constructor of the breadcrumbs is called, the Navigation.NavigationStack returns an empty list.

If created a workaround for this issue by calling the code from the constructor when the page OnAppreaing of the page is called. While this workaround works for me, its definitely not as pretty as i would like.

Do you have any tips on how to best fix this behavior?

Allow option to remove animation while navigating back.

I'm currently not using any animations while navigating through the app but instead while loading the page.

An option to remove animations (just a bool Property, like HasNavigateAnimation maybe) would be appreciated, or just any guidance on how to implement it on my own.

Migrate to MAUI

This is on my ToDo list, but just depends when I have time.

I'm open to PRs for this to help speed things up, but please leave a comment below if you want to pick this up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.