Setting SelectedItem on Breadcrumb control

Navigation for WPF Forum

Posted 15 years ago by Scott Currie
Version: 4.5.0483
Avatar
My application visualizes a complex tree structure. In order to simplify the visualization for viewing details, I am using a breadcrumb control as a filter for the tree viewer. That is, the application will only show the subtree rooted at the SelectedItem of the Breadcrumb. This is working fine in the direction where I binding the treeview itemssource to the Breadcrumb SelectedItem.

However, when I use code behind on an event handler in the tree view to set the SelectedItem of the Breadcrumb, the breadcrumb control accepts the SelectedItem, but does not show a trail along the top.

How can I force the breadcrumb to both accept a selected item and visualize the trail for that item?

Thanks,
-Scott

Comments (3)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Scott,

You need to handle the Breadcrumb.ConvertItem event and provide the proper trail from the "new" SelectedItem up to the RootItem. While the DataTemplates and Styles can be used to drill down the hierarchy, they cannot be used to work back up to the RootItem. Therefore, you have to perform this step by handling the ConvertItem event. In addition, this event can be used to convert to and from a string path.

Our Sample Browser shows how this is done in the "Breadcrumb File System" QuickStart under the Naviation section. In addition, there is a topic on this subject in our help file under "Actipro Navigation\Breadcrumb Features\Item Conversion".


Actipro Software Support

Posted 10 years ago by Ulf Johansen
Avatar

Wouldn't it be a nice feature to add a ParentSource property on the container, so you don't have to handle the ConvertItem event, which is awkward when using MVVM?

[Edit: property should probably be called ParentSource (similar to ItemsSource) since it would be the data object that you would bind.]

[Modified 10 years ago]

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Ulf,

Thanks for the suggestion.  We will write it down.


Actipro Software Support

The latest build of this product (v24.1.1) 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.