NavigationPaneExpander ignores ItemTemplate?

Jul 3, 2012 at 4: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"
                          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>

Coordinator
Jul 4, 2012 at 12:18 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Jul 4, 2012 at 5: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 11: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.
Jens

Jul 5, 2012 at 10:12 AM

Works like a charm. Thank you very much indeed.
Jens

Jul 5, 2012 at 10:51 AM
Edited Jul 5, 2012 at 2:08 PM

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

s:NavigationPaneExpander.CanResize 

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 11:52 AM

Pushing this thread again. Still unsolved, unfortunately.

Nevertheless: Happy new year :)

Coordinator
Jan 6, 2013 at 1: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 :)