【发布时间】:2014-09-19 06:05:16
【问题描述】:
我在 ItemsControl 中显示扩展器项目列表并将项目列表绑定到它。 我遵循的 xaml 结构是
<ItemsControl ItemsSource="{Binding}" >
<ItemsControl.ItemTemplate>
<DataTemplate>
<Expander ExpandDirection="Down" Style="{StaticResource ResourceKey=ExpanderItemStyle}" >
<Expander.Header>
<BulletDecorator>
//Expander header by default its collapsed
<Label Style="{StaticResource ResourceKey=ChapterHeadStyle}" Content="{Binding name}"></Label>
</BulletDecorator>
</Expander.Header>
<StackPanel> // Expander body want to collapse it when some some other items of ItemsControl is expanded
</StackPanel>
</Expander>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
当 ItemsControl 中的一些其他项目被选中时,我可以使扩展器内容自动折叠
【问题讨论】: