wpf-DataGrid 分组
2021-03-05 10:27
标签:ups useradd name initial user tac pre ace ini C# 数据: xaml: wpf-DataGrid 分组 标签:ups useradd name initial user tac pre ace ini 原文地址:https://www.cnblogs.com/dangnianxiaoqingxin/p/12899574.htmlnamespace _1.DataGridStudy
{
///
Grid>
DataGrid Name="dg1" AutoGenerateColumns="False" HorizontalAlignment="Left" VerticalAlignment="Top" CanUserAddRows="False" Margin="0">
DataGrid.Columns>
DataGridTextColumn Header="学号" Binding="{Binding 学号}" />
DataGridTextColumn Header="姓名" Binding="{Binding 姓名}" />
DataGridTextColumn Header="班级" Binding="{Binding 班级}" />
DataGrid.Columns>
DataGrid.GroupStyle>
GroupStyle >
GroupStyle.ContainerStyle>
Style TargetType="{x:Type GroupItem}">
Setter Property="Template">
Setter.Value>
ControlTemplate TargetType="{x:Type GroupItem}">
Expander IsExpanded="True">
Expander.Header>
StackPanel Orientation="Horizontal">
TextBlock Text="{Binding Name}" />
TextBlock Text=" 数量:"/>
TextBlock Text="{Binding ItemCount}"/>
StackPanel>
Expander.Header>
ItemsPresenter/>
Expander>
ControlTemplate>
Setter.Value>
Setter>
Style>
GroupStyle.ContainerStyle>
GroupStyle>
DataGrid.GroupStyle>
DataGrid>
Grid>
上一篇:前端调用api接口方法总结
下一篇:C# 设计模式之命令模式