How to use with Dynamic Content?

2 posts, 0 answers
  1. Noemata
    Noemata avatar
    15 posts
    Member since:
    Apr 2011

    Posted 12 May 2014 Link to this post

    The samples provided with the BreadCrumb control suggest it can be used to coordinate navigation through a directory tree, but the provided samples all use static content to populate the BreadCrumb control's ItemSource data.

    How can the BreadCrumb control be used with dynamic content?  For example, an XML representation that consists of an XPath that has a "Name" for a given "Folder" to represent a particular directory path where the path is built up dynamically as you navigate toward a particular target directory:


    [C:\] ^| [Root]^| [test1]^ | [test2]^

    Where each breadcrumb shown above has it's data populated as you select the next, rather than having the entire path pre-built, as shown in the provided examples?

    You would not know the target directory in advance of navigation if the Breadcrumb control were used in this manner, so the provided examples are not representative of actual usage for this scenario.

    Sample XML:
    <XmlDataProvider x:Key="FolderRoot">
    <Folder xmlns="" Name="C:\">

    Note: the above XML is built dynamically as you navigate through directory structure.  This is just the very first node.

  2. Martin Ivanov
    Martin Ivanov avatar
    2511 posts

    Posted 15 May 2014 Link to this post

    Hello Mario,

    The described requirement sounds like a load on demand functionality. I prepared a sample project which demonstrates load items on demand (dynamically) in the BreadCrumb. Basically you can generate the items in the children'ss collection in your view model. Here is an example in code for the collection property.
    public ObservableCollection<ExplorerItem> Children
                   if (this.children == null || this.children.Count == 0)
                   return this.children;
    private void LoadChildren()
               this.children.Add(new ExplorerItem() { Header = this.Header + "'s child", Path = this.Header + "'s child" });
    Please give this approach a try and let me know if I am missing something.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top