Breadcrumb DataTemplates not being applied

Navigation for WPF Forum

Posted 9 years ago by Andrew Hanlon
Version: 15.1.0623

While trying to investigate the usage of the Breadcrumb control within my MVVM application, I have noticed that the control does not automatically use DataTemplates/HierarchicalDataTemplates that are located in the current resource path, but instead requires the ItemTemplate property to be set explicitly on both the BreadCrumb control as well as the HierarchicalDataTemplates themselves.

The similarly hierarchical TreeView control automatically looks in the resources for a Hierarchical/DataTemplate that matches the bound item type.

This limitation seems problematic, as A) it adds complexity and unnecessary coupling, and B) it means that the control can therefore only work with a single ViewModel type within the child collection.

Or am I missing something fundamental?

Even the BreadCrumbPopulation sample where it states "The Breadcrumb control fully supports the HierarchicalDataTemplate class, by utilizing its ItemsSource property and associated properties. Styles must still be used to set certain visual aspects of the data, such as the icon shown on the context menus." still uses explicit ItemTemplate properties, which seems to counterintuitive from the description.

Thank you kindly.

Comments (1)

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

Hi Andrew,

While I don't believe we have any code that explcitly looks for data-item implicit DataTemplate resources, BreadcrumbItem does inherit ItemsControl, so I would expect that that sort of functionality would get inherited.

If you'd like us to look into a scenario you have, can you make a new simple sample project that shows the problem and we'll debug it?  If you send us anything, please email our support address, reference this thread, and rename the .zip file extension of what you send so it doesn't get spam blocked.  Thanks!

Also, we do offer various "selector" properties for everything (e.g. ItemContainerStyleSelector, MenuItemTemplateSelector, etc.), so that helps you to differentiate items as needed.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.