我在创造一个
DerivedListBox : ListBox
还有一个
DerivedHeaderedContentControl : HeaderedContentControl
,它将作为
ListBox
.
以计算扩展内容的可用大小
DerivedHeaderedContentControl
s、 我将每个容器对象存储在
DerivedListBox
. 这样我就可以计算出每一个标题的高度
派生HeaderedContentControl
派生列表框
派生HeaderedContentControl
.
public class DerivedHeaderedContentControl : HeaderedContentControl
{
// Do some binding to DerivedListBox to calculate height.
}
public class DerivedListBox : ListBox
{
private List<DerivedHeaderedContentControl> containers;
protected override DependencyObject GetContainerForItemOverride()
{
DerivedHeaderedContentControl val = new DerivedHeaderedContentControl();
this.containers.Add(val);
return val;
}
// Do some binding to calculate height available for an expanded
// container by iterating over containers.
}
派生列表框
ItemsSource
清除(或项目源中的项目被删除)。我如何确定
项目资源
被清除以便我可以清除容器列表?