开发者

Simple alternative for DataGridView which supports enumerations

I need something like DataGridView. It should be able to bind to the collection of the following objects:

class Register
{
   TypeEnum Type{get;set;}
   string Name{get;set;}
}

And it should display this collection and allow editing their properties: select desirable enum value from the combobox and to enter N开发者_C百科ame in the textbox. Also, adding new objects and removing existing ones should be supported.

DataGridView doesn't fit because it doesn't support enums. How this functionality can be achieved without too much manual coding?

EDIT: I tried using DataGridView for this purpose, but it is terrible. I can't add new rows or delete some without creating additional buttons with error-prone handlers. Is there any human way to achieve my goal?


There are many ways to achieve this with DataGridView itself.

1) Create dropdownbox for one column type and bind it with typeof(enum) Create drop down list options from enum in a DataGridView

2) Use TypeConverter of EnumConverter Data bind enum properties to grid and display description

Few others,

How to show Enum type members in a DataGridViewComboBox?

How to display enum values in datagridview column

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜