This is a migrated thread and some comments may be shown as answers.

Problem with HierarchicalDataTemplate

1 Answer 177 Views
BreadCrumb
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 13 Dec 2011, 06:06 PM

im having a problem with templates it seems that only the first template is used not the cascaded if i use datatemplateselector it is ignored ( SelectTemplate is never called )

im quite new so maybee im doing something wron if you need more help please contact me

Edit: the ItemSource handling is correct and currentItem is also fine just the visual tree of the nested templates are ignored and this obviously results in binding errors

cheers jan

<

 

 

UserControl

xmlns

 

 

="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns

 

 

:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns

 

 

:d="http://schemas.microsoft.com/expression/blend/2008"

xmlns

 

 

:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

xmlns

 

 

:local="clr-namespace:LibaryTest" xmlns:ViewModel="clr-namespace:LibaryTest.ViewModel"

xmlns

 

 

:View="clr-namespace:LibaryTest.View" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"

xmlns

 

 

:Breadcrumb="clr-namespace:Telerik.Windows.Controls.Breadcrumb;assembly=Telerik.Windows.Controls.Navigation"

mc

 

 

:Ignorable="d"

x

 

 

:Class="LibaryTest.View.ProductionDetailView"

x

 

 

:Name="UserControl"

d

 

 

:DesignWidth="300" d:DesignHeight="240">

 

 

<UserControl.Resources>

 

 

<HierarchicalDataTemplate x:Key="ScheduleTemplate">

 

 

<TextBlock Text="{Binding DomainObject.ScheduleName}" />

 

 

</HierarchicalDataTemplate>

 

 

<HierarchicalDataTemplate x:Key="RunTemplate" ItemsSource="{Binding ProductionSchedules}" ItemTemplate="{StaticResource ScheduleTemplate}" >

 

 

<TextBlock Text="{Binding DomainObject.RunName}" />

 

 

</HierarchicalDataTemplate>

 

 

<HierarchicalDataTemplate x:Key="ProductionTemplate" ItemsSource="{Binding ProductionSchedules}" ItemTemplate="{StaticResource RunTemplate}" >

 

 

<TextBlock Text="{Binding DomainObject.ProductionName}" />

 

 

</HierarchicalDataTemplate>

 

 

<View:NavigationDetailTemplateSelector x:Key="detailSelector"/>

 

 

<View:NavigationMasterTemplateSelector x:Key="masterSelector"/>

 

 

</UserControl.Resources>

 

 

<d:DataContext>

 

 

<ViewModel:ProductProductionViewModel />

 

 

</d:DataContext>

 

 

<Grid x:Name="LayoutRoot">

 

 

<Grid.RowDefinitions>

 

 

<RowDefinition Height="0.05*"/>

 

 

<RowDefinition Height="0.95*"/>

 

 

</Grid.RowDefinitions>

 

 

<telerik:RadBreadcrumb x:Name="navigationView"

 

Header="{Binding}"

 

Grid.Row="0"

 

ItemTemplate="{DynamicResource ProductionTemplate}"

 

ItemsSource="{Binding ProductProductionRuns}"

 

IsTextModeEnabled="False"

 

/>

 

 

<!--

ItemTemplateSelector="{DynamicResource masterSelector}"

HeaderTemplateSelector="{DynamicResource masterSelector}"

HeaderTemplate="{DynamicResource RunTemplate}"

ItemTemplate="{DynamicResource ProductionTemplate}"

HeaderTemplate="{DynamicResource ProductionTemplate}"

<TreeView x:Name="navigationView" ItemsSource="{Binding ProductProductionRuns}" Grid.Row="0" ItemTemplate="{DynamicResource RunTemplate}" />

-->

 

 

<!--

this is working fine

<ContentControl x:Name="DetailView"

DataContext="{Binding CurrentItem, ElementName=navigationView}"

ContentTemplateSelector="{DynamicResource detailSelector}"

Grid.Row="1"

Content="{Binding DataContext, RelativeSource={RelativeSource Self}}" >

</ContentControl>-->

 

 

 

 

</Grid>

</

 

 

UserControl>

1 Answer, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 15 Dec 2011, 11:22 AM
Hi Jan,
The problem is that the RadBreadcrumb hierarchy is not a full Tree-like hierarchy and that's why the HierarchicalDataTemplate doesn't work as you expect. For us the breadcrumb has only two levels in its hierarchy - the first level is for the items that are in the bar area and the second one is for the items in the dropdown popups.
As for the DataTemaplteSelector - there seems to be a bug with it and I logged it in our PITS under the name "Breadcrumb: ItemTemplateSelector doesn't work" and it'll be ready for tracking tomorrow the latest. There's a workaround for your problem - instead of an ItemTemplateSelector you can use a ItemContainerStyleSelector and select a style with HeaderTemplate setter for each individual item.
I've updated your telerik account and I've also attached a sample project so could you please examine it and if you have more questions feel free to ask.

Greetings,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
BreadCrumb
Asked by
Jan
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Share this question
or