回复 3楼roxland的帖子
AutoGenerateColumns属性是控制列的。
增加合计行,XAMLcode参考如下:
- <c1:C1DataGrid x:Name="grid" AutoGenerateColumns="False" CanUserAddRows="False" CanUserRemoveRows="False" ItemsSource="{Binding Players}" c1:C1NagScreen.Nag="True">
- <c1:C1DataGrid.Columns>
- <c1:DataGridTextColumn GroupState="Ascending,0" SortState="Ascending,0" SortMemberPath="Name" FilterMemberPath="Name" Width="150" Header="Match" Binding="{Binding Match}">
- </c1:DataGridTextColumn>
- <c1:DataGridTextColumn Width="150" Header="Goals" Binding="{Binding Goals}">
- <c1:DataGridAggregate.AggregateFunctions>
- <c1:DataGridAggregatesCollection>
- <c1:DataGridAggregateSum />
- </c1:DataGridAggregatesCollection>
- </c1:DataGridAggregate.AggregateFunctions>
- </c1:DataGridTextColumn>
- <c1:DataGridTextColumn Width="50" Header="Minutes" Binding="{Binding Minutes}">
- <c1:DataGridAggregate.AggregateFunctions>
- <c1:DataGridAggregatesCollection>
- <c1:DataGridAggregateSum />
- </c1:DataGridAggregatesCollection>
- </c1:DataGridAggregate.AggregateFunctions>
- </c1:DataGridTextColumn>
- </c1:C1DataGrid.Columns>
- <c1:C1DataGrid.BottomRows>
- <c1:DataGridSummaryRow />
- <c1:DataGridSummaryRow />
- </c1:C1DataGrid.BottomRows>
- </c1:C1DataGrid>
复制代码
需要在LoadedCellPresenter 添加的代码:
- If e.Cell.Row.GetType() Is GetType(C1.Silverlight.DataGrid.Summaries.DataGridSummaryRow) Then
- Dim _presenter = DirectCast(DirectCast(e.Cell.Presenter.Content, System.Windows.Controls.StackPanel).Children(0), System.Windows.Controls.ContentPresenter)
- If (e.Cell.Row.Index = grid.Rows.Count – 2 AndAlso e.Cell.Column.Index = 2) Or (e.Cell.Row.Index = grid.Rows.Count – 1 AndAlso e.Cell.Column.Index = 1) Then
- _presenter.Content = String.Empty
- End If
- End If
复制代码 |