数字 Eto 网格单元格?
Numeric Eto Grid cell?
如何在 Eto forms GridView 中创建数字列(最好是整数)?
下面是我的两个字符串列的代码
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"
});
要使用不同的列,您可以使用 属性 绑定上的 Convert() 扩展将整数 属性 转换为字符串,如下所示:
Binding.Property((RulesDocAdapter r) => r.IntProperty).Convert(v => v.ToString(), s => { int i = 0; return int.TryParse(s, out i) ? i : -1; })
如何在 Eto forms GridView 中创建数字列(最好是整数)?
下面是我的两个字符串列的代码
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"
});
要使用不同的列,您可以使用 属性 绑定上的 Convert() 扩展将整数 属性 转换为字符串,如下所示:
Binding.Property((RulesDocAdapter r) => r.IntProperty).Convert(v => v.ToString(), s => { int i = 0; return int.TryParse(s, out i) ? i : -1; })