NavigationPaneExpander ignores ItemTemplate?

Jul 3, 2012 at 3:12 PM

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"
                          ItemsSource="{Binding ActiveAssistanceAreas}">
               <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}}"/>

Jul 4, 2012 at 11:18 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 4, 2012 at 4:03 PM

Fixed with the last ChangeSet.
It works regularly for the ItemTemplate, while for the header templates you should access item properties trought the "Cotent" property... please see the work item for futher informations.

I added an example usage of the ItemsSource and relative templates in the demo app main window.

Thanks for spotting it !

Jul 4, 2012 at 10:19 PM

Wow, great. Really quick.

I will take a look tomorrow morning, it's late and I need some sleep :)

Thanks a lot in advance.

Jul 5, 2012 at 9:12 AM

Works like a charm. Thank you very much indeed.

Jul 5, 2012 at 9:51 AM
Edited Jul 5, 2012 at 1:08 PM

Sorry, I dont' want to get on your nerves, but it seems that  


will not be recognized with the ItemTemplate. Do you see any possibility that this could be changed?
Anyway, keep up the good work.


PS: And it Seems that chaning the ItemsSource at runtime, does not Reinitialise the itemHeaders.
Just playing around with it, but still looking for a solution.

Dec 27, 2012 at 10:52 AM

Pushing this thread again. Still unsolved, unfortunately.

Nevertheless: Happy new year :)

Jan 6, 2013 at 12:26 PM
Akkarin wrote:

Pushing this thread again. Still unsolved, unfortunately.

Nevertheless: Happy new year :)

I finally got the time to get into that... I made some small changes on the code that should solve.
You should dowload the last checkin to use them.

Essentially, if you are using navigationpaneexpander with the itemsSource and an ItemTemplate, if the ItemsSource object has a property named "CanResize", that will be automatically binded to the NavigationPaneExpander.CanResize of the containing item, allowing non frameworelement objects to change the property.

I also forced the itemsHeader collection to empty and set it to null, so now it should recreate the headers... that is not yet tested though

Happy 2013 :)