找回密码
 立即注册

QQ登录

只需一步,快速开始

CanYou1

高级会员

45

主题

227

帖子

1359

积分

高级会员

积分
1359

活字格认证微信认证勋章元老葡萄

CanYou1
高级会员   /  发表于:2015-12-15 16:49  /   查看:4601  /  回复:5



Alice,如何把标出的两个地方的名称改成中文?

本帖子中包含更多资源

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

x

5 个回复

倒序浏览
Alice
社区贡献组   /  发表于:2015-12-15 17:30:00
沙发
回复 1楼CanYou1的帖子

谢谢您的反馈。
默认显示的格式如您图中所示。
如果您相对分组标题进行自定义的话,可以使用GroupHeaderConverter,对GroupHeader的GroupDescription表述进行设置。
使用方法参考:
  1. class GroupHeaderConverter : IValueConverter
  2. {
  3.   public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  4.   {
  5.     var gr = parameter as GroupRow;
  6.     var group = gr.Group;
  7.     if (group != null && gr != null && targetType == typeof(string))
  8.     {
  9.       var desc = gr.Grid.CollectionView.GroupDescriptions[gr.Level] as PropertyGroupDescription;
  10.       return desc != null
  11.         ? string.Format("{0}: {1} ({2:n0} item{3})",
  12.             desc.PropertyName,
  13.             group.Name,
  14.             group.ItemCount,
  15.             group.ItemCount == 1 ? string.Empty : "s")
  16.         : string.Format("{0} ({1:n0} items)", group.Name, group.ItemCount);
  17.     }

  18.     // default
  19.     return value;
  20.   }
  21.   public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  22.   {
  23.     return value;
  24.   }
  25. }
复制代码
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
CanYou1
高级会员   /  发表于:2015-12-15 17:34:00
板凳
回复 2楼Alice的帖子

这么复杂啊?不能只是设置下某个属性吗?我这个是参照你们C1FlexGrid的Sample来做的
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-12-16 09:33:00
地板
回复 3楼CanYou1的帖子

Coverter是WPF中基本的用法。
您的需求是自定义,自定义需要Converter去完成。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
CanYou1
高级会员   /  发表于:2015-12-16 15:38:00
5#
回复 4楼Alice的帖子

好的,我先用您提供的方法试试,谢了。
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-12-16 17:27:00
6#
回复 5楼CanYou1的帖子

嗯,谢谢您的反馈。
请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部