LookUpEdit.SetCheckBoxSelectorMemberValue Event
Allows you to post values that correspond to the selected item state to the data source field specified by the CheckBoxSelectorMember property.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.2.dll
Declaration
[DXCategory("Events")]
public event EventHandler<PopupCheckBoxSelectorMemberValueEventArgs> SetCheckBoxSelectorMemberValue
Event Data
The SetCheckBoxSelectorMemberValue event's data class is PopupCheckBoxSelectorMemberValueEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
IsSelected | Gets whether the item is selected. |
OriginalValue | Gets the value in the data source. |
Value | Gets or sets the value posted to the data source. |
Remarks
In Multiple Item Selection mode, you can use the CheckBoxSelectorMember property to define the item’s selected state based on the data source object’s property.
Handle the QueryCheckBoxSelectorMemberIsSelected and SetCheckBoxSelectorMemberValue
events to convert field values if the specified field is not of the Boolean type:
public partial class Form1 : DevExpress.XtraEditors.XtraForm {
public Form1() {
// ...
lookUpEdit1.Properties.ValueMember = "ID";
lookUpEdit1.Properties.DisplayMember = "Name";
lookUpEdit1.Properties.EditValueType = DevExpress.XtraEditors.Repository.LookUpEditValueType.CSVString;
lookUpEdit1.Properties.CheckBoxSelectorMember = "Manager";
}
}
// Selects an item if its "Department.Manager" property is equal to the "Manager.FullName" property.
void lookUpEdit1_QueryCheckBoxSelectorMemberIsSelected(object sender, PopupCheckBoxSelectorMemberIsSelectedEventArgs e) {
e.IsSelected = ((string)e.Value == manager.FullName);
}
// Posts the "Manager.FullName" property value to the "Department.Manager" property based on selection.
void lookUpEdit1_SetCheckBoxSelectorMemberValue(object sender, PopupCheckBoxSelectorMemberValueEventArgs e) {
if(e.IsSelected)
e.Value = manager.FullName;
else e.Value = null;
}
public class Manager {
public int ID { get; set; }
public string FullName { get; set; }
public string Departments { get; set; }
}
public class Department {
public int ID { get; set; }
public string Name { get; set; }
public string Manager { get; set; }
}