找回密码
 立即注册

QQ登录

只需一步,快速开始

feiyan0320

中级会员

17

主题

70

帖子

615

积分

中级会员

积分
615

活字格认证微信认证勋章

QQ
feiyan0320
中级会员   /  发表于:2015-10-5 19:19  /   查看:9382  /  回复:10
  1. <c1:DataGridTextColumn  Header="价格"   Binding="{Binding SalePrice}" Format="C2">
  2.                     <c1:DataGridAggregate.AggregateFunctions>
  3.                         <c1:DataGridAggregatesCollection>
  4.                             <c1:DataGridAggregateSum ResultFormat=" {0} "></c1:DataGridAggregateSum>
  5.                         </c1:DataGridAggregatesCollection>
  6.                     </c1:DataGridAggregate.AggregateFunctions>
  7.                 </c1:DataGridTextColumn>
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

10 个回复

倒序浏览
Alice
社区贡献组   /  发表于:2015-10-8 09:53:00
沙发
回复 1楼feiyan0320的帖子

谢谢你对该问题的反馈。
根据你的提示信息,已经重现了该问题。
测试示例:
\Documents\ComponentOne Samples\WPF\C1.WPF.DataGrid\CS\DataGridSamples\Grouping\GroupSummary

已经提交到产品组调查原因后给你反馈,很抱歉给你带来的不便。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
feiyan0320
中级会员   /  发表于:2015-10-8 10:38:00
板凳
回复 2楼Alice的帖子

多谢版主,终于把你盼来了
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-10-8 13:46:00
地板
回复 3楼feiyan0320的帖子

如果在英文机器上会正常显示,推测是由于Summary合计的时候i考虑到当前线程的culture或是操作系统的culture。
在这种情况下,建议调用C1DataGrid的LoadedCellPresenter事件,来自定义单元格的text。
如下是建议的代码:
  1. void grid_LoadedCellPresenter(object sender, DataGridCellEventArgs e)
  2.         {
  3.             if (e.Cell.Row.Type == DataGridRowType.Group)
  4.             {
  5.                 string text=((System.Windows.Controls.ContentPresenter)(((System.Windows.Controls.Panel)(e.Cell.Presenter.Content)).Children[0])).Content as string;
  6.                 text=text.Trim('&#165;');
  7.                 text = &quot;$&quot; + text;
  8.                 ((System.Windows.Controls.ContentPresenter)(((System.Windows.Controls.Panel)(e.Cell.Presenter.Content)).Children[0])).Content = text;
  9.             }
  10.         }

复制代码
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
feiyan0320
中级会员   /  发表于:2015-10-8 15:28:00
5#
回复 4楼Alice的帖子

我直接把代码粘过去的,貌似没有起作用哦
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-10-8 16:12:00
6#
回复 5楼feiyan0320的帖子

你好。
我是使用随机安装示例做测试,示例参考:
\Documents\ComponentOne Samples\WPF\C1.WPF.DataGrid\CS\DataGridSamples\Grouping\GroupSummary

这段代码的逻辑是判断是分组统计的行,然后获取文字,如果文字里有currency的符号,就将符号去掉,替换成自己所需要的符号,然后重新设置回去。

这段代码需要根据系统的语言做修改后才能使用。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
feiyan0320
中级会员   /  发表于:2015-10-13 11:12:00
7#
回复 6楼Alice的帖子

e.Cell.Row.Type
版主给的例子里,这个在有合计的列里,不是group,还是item,所以判断进不去
回复 使用道具 举报
feiyan0320
中级会员   /  发表于:2015-10-13 11:30:00
8#
回复 7楼feiyan0320的帖子

string text=((System.Windows.Controls.ContentPresenter)(((System.Windows.Controls.Panel)(e.Cell.Presenter.Content)).Children[0])).Content as string;

这句也有问题
e.Cell.Presenter.Content
这个出来应该是TextBlock
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-10-13 12:01:00
9#
回复 8楼feiyan0320的帖子

很抱歉在2楼提供的示例中测试4楼的代码,无法重现你的问题。

如果你是在将代码添加到本身程序中产生了问题,请将出问题的Demo发给我,我帮你看看。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
feiyan0320
中级会员   /  发表于:2015-10-13 13:19:00
10#
回复 8楼feiyan0320的帖子

这个没事了,我换了另外一种方法,多谢哦
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部