【发布时间】:2016-12-19 13:21:08
【问题描述】:
我有一个包含组项列表的列表框,其中包含“扩展器”中的每个组项,并且它总是在第一次实例中折叠。当一个项目被添加到特定组的列表框中时,那时该组的相应扩展器应该被展开(IsExpanded=true)。
以下是我目前尝试过的风格。我在这里有什么遗漏吗?
<Style x:Key="GroupContainerStyleA" TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Expander IsExpanded="False" Style="{StaticResource ExpanderStyle}">
<Expander.Header>
<Border>
<TextBlock Text="{Binding Path=Name}" FontWeight="Bold" Foreground="White"/>
</Border>
</Expander.Header>
<Border Background="White" Margin="1.5,0,1.5,1.5" BorderBrush="{StaticResource SideButtonBackgroundBrushKey}" BorderThickness="0.5">
<ItemsPresenter Margin="5,0,0,5"/>
</Border>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
【问题讨论】: