Breadcrumb Binding

Navigation for WPF Forum

Posted 16 years ago by John Whisler
Version: 3.5.0429
Avatar
I am trying to bind a breadcrumb control to a hierarchical data source, so far without success.

My data source is a clr object, already instantiated when the breadcrumb control is instantiated.

First question - can this be done? (the quick start on this topic binds only to an xml data source).

The object I want to bind to is a very uniform tree - I keep thinking this should be easy. It is a tree where every node is of this type (somewhat simplified):

public class Item
{
private string name;

... other properties ...

private List<Item> childItems;

public string Name
{
get { return this.name; }
set { this.name = value; }
}

... accessors for other properties ...

public List<Item> ChildItems
{
get { return this.childItems; }
set { this.childItems= value; }
}

public Item()
{
this.childItems= new List<Item>();
}
}

I want the TextBlock of the BreadcrumbItem to show the Name property and the TextBlock of the MenuItems to show the ChildItems' Name property. The tree is not of fixed depth. There can be zero or more ChildItems attached to any Item. I want to give a single object of type Item to the breadcrumb control to be its root. It should navigate the tree itself knowing that the ItemSource for the next level down is always ChildItems. I need to be able to bind the root to the breadcrumb in c# code so it is dynamic.

Second question: Help? I have tried using both approaches (Styles only and Hierarchical Data Templates + Styles) without success.

Thanks,
John

Comments (1)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi John,

It is definitely possible and the Breadcrumb File System QuickStart shows how to bind to .Net objects. In that example, there are a few more levels that what you have (drives and then folders).

If that QuickStart doesn't help, then please post the DataTemplates and Styles you have defined and we can take a look.


Actipro Software Support

The latest build of this product (v24.1.3) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.