GridView使用
来源:互联网 发布:淘宝钓鱼望远镜 编辑:程序博客网 时间:2024/04/30 20:05
一、定义GridViewStyle
1).定义GridVeiwStyle
<s:EditorPage.Resources>
<s:InvertedBooleanConverter x:Key="InvertedBooleanConverter" />
<Style x:Key="GridViewStyle" TargetType="{x:Type s:SmartGridView}">
<Setter Property="AutoGenerateColumns" Value="False" />
<Setter Property="IsFilteringAllowed" Value="False" />
<Setter Property="CanUserFreezeColumns" Value="True" />
<Setter Property="FrozenColumnCount" Value="3" />
<Setter Property="ShowColumnFooters" Value="True" />
<Setter Property="ShowGroupPanel" Value="False" />
<Setter Property="RowIndicatorVisibility" Value="Collapsed" />
</Style>
</s:EditorPage.Resources>
2).邦定Stytle
<s:SmartGridView
Style="{StaticResource GridViewStyle}"
...>
二、合计
1).记录数、最大值、最小值...
<s:SmartDataColumn Header="年度" IsReadOnly="True" Width="50" DataMemberBinding="{Binding aYear}">
<s:SmartDataColumn.AggregateFunctions>
<telerik:CountFunction Caption="筆數:" />
</s:SmartDataColumn.AggregateFunctions>
</s:SmartDataColumn>
//注意:运行时会自动将 CountFunction 的但值放到“筆數:”后面
2).栏目合计
<s:SmartDataColumn Header="本次收款"
DataFormatString="{}{0:0.00}"
DataMemberBinding="{Binding PayAmt}"
FooterTextAlignment="Right"
TextAlignment="Right">
<s:SmartDataColumn.AggregateFunctions>
<telerik:SumFunction ResultFormatString="{}{0:0.00}" SourceField="PayAmt" />
</s:SmartDataColumn.AggregateFunctions>
<s:SmartDataColumn.Footer>
<TextBlock Text="{Binding FormattedValue}" FontWeight="Bold" Foreground="Blue" />
</s:SmartDataColumn.Footer>
</s:SmartDataColumn>
三、行加入“操作”按钮
<s:SmartDataColumn Header="操作" Width="40">
<s:SmartDataColumn.CellTemplate>
<DataTemplate>
<Button Content="付" Click="OnPayClick" />
</DataTemplate>
</s:SmartDataColumn.CellTemplate>
</s:SmartDataColumn>
四、强行刷新“合计”
private void OnPayClick(object sender, RoutedEventArgs e)
{
var rowView = (DataRowView)(sender as FrameworkElement).DataContext;
if (rowView.Row.Field<decimal>("PayAmt") == 0)
{
rowView["PayAmt"] = rowView["RemainAmount"];
}
else
{
rowView["PayAmt"] = 0;
}
this.Grid.CalculateAggregates(); //刷新行合計
}
效果如下图:
- GRIDVIEW 使用
- Gridview使用
- GridView使用
- gridview 使用
- GridView 使用
- GridView使用
- GridView 使用
- GridView 使用
- GridView使用
- GridView使用
- GridView 使用
- GridView使用
- GridView使用
- GridView使用
- GridView使用
- GridView控件使用经验
- Gridview+sqldatasource使用注意事项
- GridView的使用
- SQL Server命令
- Linux命令:date 时间戳数字与字符串格式转换
- 黑马程序员:JAVA各运算符中的注意点及小技巧介绍
- html 局部 强制出现滚动条
- javascript - 得到鼠标点击的相对位置
- GridView使用
- UItableView中含输入框(TextField)被键盘遮挡问题
- 九月腾讯,创新工场,淘宝等公司最新面试三十题(第171-200题)
- hdu 3870 Catch the Theves(平面最小割)
- SCSF - Part 9 The Command Design Pattern
- Eclipse添加代码行数统计插件步骤及应用
- Linux下 ftp 命令的使用
- 十月上旬百度,阿里巴巴,迅雷搜狗最新面试七十题(第201-270题)
- java中hashcode和equals的区别