[英]How to save CheckBoxRowSelect in Devexpress GridView to class object
I've simple class called "Order". 我有一个简单的类叫做“订单”。
class Order {
public string ID { get;set;}
public string Something {get;set;}
.... more fields...
}
I then assign list of orders into DataSource of GridControl. 然后,我将订单列表分配到GridControl的DataSource中。
List <Order> ListOfOrders = new Order();
gridControl.DataSource = ListOfOrders;
I've added a CheckBoxRowSelect option in GUI so that user can choose rows by selecting the checkbox. 我在GUI中添加了CheckBoxRowSelect选项,以便用户可以通过选中复选框来选择行。 What value do I need to add to
class Order
so that any checkbox change in that GridControl
gets updated in instant in it's own field so that the ListOfOrders
is always up to date and has that checkbox value stored so it can be processed? 我需要为
class Order
添加什么值,以便GridControl
复选框的任何更改都可以在其自己的字段中立即更新,以便ListOfOrders
始终是最新的并且存储了该复选框的值以便可以处理?
I've made similar thing with ComboBox
inside one of the columns and it seems to work instantly without any additional change on my part. 我在其中一列中使用
ComboBox
做了类似的事情,它似乎可以立即工作,而无需我做任何其他更改。
var columnKurier = view.Columns.AddField("Courier");
columnKurier.ColumnEdit = riCombo;
columnKurier.VisibleIndex = 0;
columnKurier.OptionsColumn.AllowFocus = true;
I simply had to add Courier
field into Order
class and that's it. 我只需要将
Courier
字段添加到Order
类即可。 But i don't know which "field name" should it be for checkbox and whether it will get the same behaviour as for the ComboBox
. 但是我不知道复选框应该使用哪个“字段名称”,以及它是否将获得与
ComboBox
相同的行为。
Add in your object order : 按对象顺序添加:
public Boolean Mark{get;set;}
and in your your form contructor : 并在您的表单构造器中:
InitializeComponent();
new GridCheckMarksSelection(gridControl);
i have atach a class GridCheckMarksSelection you must add it in your project. 我有一个GridCheckMarksSelection类,您必须将其添加到您的项目中。
I hop that you want 我希望你想要
您不能将CheckBoxRowSelect
选项添加到GridControl
,而只能在Class
Order中使用bool
字段,它应该在GridControl
显示为复选框。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.