I'm trying to build a Panel or ItemsControl that will display items in the form of:
Header 1
- Sub Item 1
- Sub item 2
- Sub Item 3
Header 2
- Sub Item 1
- Sub item 2
This is easy enough, but the catch here is that I need to be able to split the items in a Paged fashion. Based on the height of the control, whatever does not fit will be on the next Page (and so on). If a split occurs between subitems, I need to re-display the corresponding header on the next page as well.
I made some progress working with MeasureOverride and ArrangeOverride but I keep running into dead-ends. It's really frustrating because this is something that is computationally trivial but a nightmare to accomplish in WPF/Silverlight. If you have ever worked with reporting packages, the concept is very similar to this.
I keep coming back to the fact that I can't determine the height until after I have added the children to the control (using Dispatcher.BeginInvoke).
Does anyone have any suggestions for accomplishing this? Thanks in advance!
Edit
[WPF] ObservableCollection and ListBoxItem DataTemplate generation problem
This above link is very similar to what mdm20 has suggested, but I am still stuck. Everytime I try to get the ActualHeight, it returns 0. Additionally, the ItemContainerGenerator in Silverlight 3 returns null for the container unless I wrap the call in a Dispatcher.BeginInvoke operation.