windowsforms-devexpress-dot-xtraeditors-dot-lookupedit-484aadb9.md
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.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DXCategory("Events")]
public event EventHandler<PopupCheckBoxSelectorMemberValueEventArgs> SetCheckBoxSelectorMemberValue
<DXCategory("Events")>
Public Event SetCheckBoxSelectorMemberValue As EventHandler(Of PopupCheckBoxSelectorMemberValueEventArgs)
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. |
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; }
}
Public Partial Class Form1
Inherits DevExpress.XtraEditors.XtraForm
Public Sub New()
lookUpEdit1.Properties.ValueMember = "ID"
lookUpEdit1.Properties.DisplayMember = "Name"
lookUpEdit1.Properties.EditValueType = DevExpress.XtraEditors.Repository.LookUpEditValueType.CSVString
lookUpEdit1.Properties.CheckBoxSelectorMember = "Manager"
End Sub
End Class
' Selects an item if its "Department.Manager" property is equal to the "Manager.FullName" property.
Private Sub lookUpEdit1_QueryCheckBoxSelectorMemberIsSelected(ByVal sender As Object, ByVal e As PopupCheckBoxSelectorMemberIsSelectedEventArgs)
e.IsSelected = (CStr(e.Value) = manager.FullName)
End Sub
' Posts the "Manager.FullName" property value to the "Department.Manager" property based on selection.
Private Sub lookUpEdit1_SetCheckBoxSelectorMemberValue(ByVal sender As Object, ByVal e As PopupCheckBoxSelectorMemberValueEventArgs)
If e.IsSelected Then
e.Value = manager.FullName
Else
e.Value = Nothing
End If
End Sub
Public Class Manager
Public Property ID As Integer
Public Property FullName As String
Public Property Departments As String
End Class
Public Class Department
Public Property ID As Integer
Public Property Name As String
Public Property Manager As String
End Class
See Also