我正在尝试构建一个 Panel 或 ItemsControl ,它将以以下形式显示项目:
标题 1
- 子项 1
- 子项 2
- 分项 3
标题 2
- 子项 1
- 子项 2
这很容易,但这里的问题是我需要能够以分页方式拆分项目。根据控件的高度,不适合的内容将出现在下一页(依此类推)。如果子项之间发生拆分,我还需要在下一页上重新显示相应的标题。
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.