This project is read-only.
1

Closed

NavigationPaneExpander ignores ItemTemplate?

description

Good evening,
 
I just accidentally found this quite nice control, while looking for Expander-Styles.
 
I really just need the NavigationPaneExpander. And I'm just trying to exchange my ItemsControl which was working correct with the new Expander. Unfortunately I does not really work and I really can't explain why.
 
I'm binding the ItemsSource to an ObservableCollection<Object>.
The collection might contain Usercontrols, then everything is fine. But the collection even might contain my ViewModels, which can't be drawn, which is why I'm using a litte Converter (SideAreaConverter).
 
 
Everything works well with ListBox or ItemsControl. But it does not work with the NavigationPaneExpander. It seems, that the ItemTemplate will simply be ignored.
The Converter will not be started.
 
Any hints would be highyl appreciated. I really would like to use this beautyful control,
but I have to use my own ItemTemplate.
 
<s:NavigationPaneExpander Width="200"
                      Margin="0,0,2,1"
                      DockPanel.Dock="Right"
                      Orientation="Right"
                      ItemsSource="{Binding ActiveAssistanceAreas}">
 <s:NavigationPaneExpander.ItemTemplate>
     <DataTemplate>
           <ContentControl BorderBrush="Green" BorderThickness="4" Background="Red" FocusManager.IsFocusScope="True"  cls:FocusExtension.IsFocused="{Binding FocusAssistanceArea}"  HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"  VerticalAlignment="Top" Content="{Binding Path=., Converter={StaticResource SideAreaConverter}}"/>
      </DataTemplate>
 </s:NavigationPaneExpander.ItemTemplate>
</s:NavigationPaneExpander>
Closed Jul 4, 2012 at 4:40 PM by 0xfefi

comments

wrote Jul 4, 2012 at 4:40 PM

Resolved with changeset 77781.

0xfefi wrote Jul 4, 2012 at 4:52 PM

There was an problem with the templates on the Expander... in fact ignored !!

Some notes about the fix ( nly avaible by downloading the source code for the moment ):
While the ItemTemplate works as usual the ItemHeaderTemplate doesn't !

In the ItemTemplate the DataContext refers to the current item in the DataSource Collection. So you will use the usual Binding method with the item propertiies names.
<TextBlock Text={Binding PropertyName} />

In the Header data template, due to the internals of the component, you access the item trought the Content Property.
<TextBlock Text="{Binding Content.PropertyName}/>

At the moment it is not possible to enable or disable resizing of items having item without header ( unless your Header Data Template generates an empty one based on item properties ! )

wrote Feb 21, 2013 at 11:30 PM

wrote May 16, 2013 at 11:00 AM