locked
ItemsTemplate and DockPanel RRS feed

  • Question

  • Hi!

    I'm trying to use a DockPanel instead of the StackPanel for a HeaderedItemsControl. I know how to get it to work but only for vertical (left->right) docking. How can I have a HeaderedItemsControl with every item docked to Top and the last item fills the remaining space (LastChildFill = True).

     

    Thanks.

    Friday, December 29, 2006 5:40 PM

Answers

  • Does setting the DockPanel.Dock attached property to Top in the ItemContainerStyle do the trick?  You might have to have custom logic which prevents that property from being set for the last item (so that it will "dock to fill").
    Friday, December 29, 2006 7:36 PM

All replies

  • Does setting the DockPanel.Dock attached property to Top in the ItemContainerStyle do the trick?  You might have to have custom logic which prevents that property from being set for the last item (so that it will "dock to fill").
    Friday, December 29, 2006 7:36 PM
  • Thanks, that worked!

    I tried to set the DockPanel.Dock property in the ItemTemplate which doesn't make sense now that I think about it.

    The LastChildFill thing doesn't work out-of-the-box tho. How could I achieve that? I thought by specifying a DockPanel with LastChildFill="True" in the ItemPanel property would be enough but it doesn't seem to be.

    Thanks!

    Saturday, December 30, 2006 12:36 AM
  • I suspect the LastChildFill feature isn't working because the last item container has been assigned a value for the DockPanel.Dock property.  If you add in custom logic which prevents the last item container from having a value for that attached property, it should work (I assume).  How exactly one might go about adding in that custom logic, I'm don't know off the top of my head.  Perhaps a trigger?
    Saturday, December 30, 2006 2:13 AM