0
我对我所实现的分组和已定义的groupstyle内的膨胀机的列表视图,如下所示:扩展器内部的ListViewItem
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Margin" Value="0,0,0,5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True" >
<Expander.Header>
<DockPanel>
<TextBlock FontWeight="Bold" Text="{Binding Path=Name}" Margin="5,0,0,0" Width="100"/>
<TextBlock FontWeight="Bold" Text="{Binding Path=ItemCount}"/>
<TextBlock FontWeight="Bold" Text=" Items"/>
</DockPanel>
</Expander.Header>
<Expander.Content>
<ItemsPresenter />
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListView.GroupStyle>
我想修改,使得仅一个被扩展的扩展器和所述其余是否崩溃,如果不止一个在那里,如果我想以编程方式展开任何一个扩展器即假设我从cs添加一个对象并且想要显示展开器已打开,那应该是可能的,任何建议? 在此先感谢
编辑:到ListView和组绑定代码:
CollectionViewSource viewSource = new CollectionViewSource { Source = TO_DOlst };
viewSource.GroupDescriptions.Add(new PropertyGroupDescription("timeCategory"));
lstView.ItemsSource = viewSource.View;
timecategory是类的成员
谢谢....我会尝试.....以及如果我编程式地想要扩展其中之一,就像当我向它添加一个新项目时一样,是可能的? – Dannyboy
另外,我已经添加了我用来绑定在我的编辑中的代码,如何将扩展器绑定到isexpanded,如果它是类的一部分,那么不会有多个值,每个项目一个? – Dannyboy