jjzjj

DisplayNameAttribute

全部标签

c# - 当 AutoGenerateColumns = True 时如何重命名 DataGrid 列?

我有一个简单的数据结构类:publicclassClient{publicStringname{set;get;}publicStringclaim_number{set;get;}}我将其输入DataGrid:this.data_grid_clients.ItemSource=this.clients;我想更改列标题。即:claim_number到“claim编号”。我知道这可以在您通过执行以下操作手动创建列时完成:this.data_grid_clients.Columns[0].Header="ClaimNumber"但是,Columns属性在自动生成列时为空。有没有办法重命名列

c# - DisplayNameAttribute 的本地化

我正在寻找一种方法来本地化PropertyGrid中显示的属性名称。可以使用DisplayNameAttribute属性“覆盖”属性的名称。不幸的是,属性不能有非常量表达式。所以我不能使用强类型资源,例如:classFoo{[DisplayAttribute(Resources.MyPropertyNameLocalized)]//donotcompilestringMyProperty{get;set;}}我环顾四周,发现了一些从DisplayNameAttribute继承的建议,以便能够使用资源。我最终会得到如下代码:classFoo{[MyLocalizedDisplayAttr

c# - DisplayNameAttribute 的本地化

我正在寻找一种方法来本地化PropertyGrid中显示的属性名称。可以使用DisplayNameAttribute属性“覆盖”属性的名称。不幸的是,属性不能有非常量表达式。所以我不能使用强类型资源,例如:classFoo{[DisplayAttribute(Resources.MyPropertyNameLocalized)]//donotcompilestringMyProperty{get;set;}}我环顾四周,发现了一些从DisplayNameAttribute继承的建议,以便能够使用资源。我最终会得到如下代码:classFoo{[MyLocalizedDisplayAttr