首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >数字Eto网格单元格?

数字Eto网格单元格?
EN

Stack Overflow用户
提问于 2016-11-03 23:13:51
回答 1查看 314关注 0票数 2

如何在Eto窗体GridView中创建数字列(理想情况下为整数)?

下面是我对两个字符串列的代码

代码语言:javascript
复制
stats.Columns.Add(new GridColumn
{
    DataCell = new TextBoxCell { Binding = Binding.Property<RulesDocAdapter, string>(r => r.Name) },
    HeaderText = "Name"
});

stats.Columns.Add(new GridColumn
{
     DataCell = new TextBoxCell { Binding = Binding.Property<RulesDocAdapter, string>(r => r.Abbreviation) },
     HeaderText = "Abbreviation"
});
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-04 04:10:51

若要使用不同的列,可以使用属性绑定上的so()扩展名将整数属性转换为字符串,如下所示:

代码语言:javascript
复制
Binding.Property((RulesDocAdapter r) => r.IntProperty).Convert(v => v.ToString(), s => { int i = 0; return int.TryParse(s, out i) ? i : -1; })
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40412778

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档