Skip to main content
All docs
V25.1
  • RepositoryItemLookUpEdit.EnableEditValueCollectionEditing Property

    Gets or sets whether you can bind the LookUpEdit.EditValue property to a read-only property of a collection type. With this option enabled, the editor calls the collection’s methods to add and remove items.

    Namespace: DevExpress.XtraEditors.Repository

    Assembly: DevExpress.XtraEditors.v25.1.dll

    NuGet Package: DevExpress.Win.Navigation

    Declaration

    [DefaultValue(DefaultBoolean.Default)]
    [DXCategory("Data")]
    public virtual DefaultBoolean EnableEditValueCollectionEditing { get; set; }

    Property Value

    Type Default Description
    DefaultBoolean Default

    True to use the collection’s methods to add and remove items.

    False to create a new collection each time the EditValue property is changed.

    Default is True if the EditValue property is bound to a read-only property of a collection type.

    Available values:

    Name Description Return Value
    True

    The value is true.

    0

    False

    The value is false.

    1

    Default

    The value is specified by a global option or a higher-level object.

    2

    Remarks

    In ValueList multiple selection mode, the LookUpEdit.EditValue property contains a List<object> object with selected items. The EnableEditValueCollectionEditing property allows you to bind the EditValue property to a read-only property of a collection type (for example, a HashSet<T>).

    public partial class Form1 : Form {
        Employee person;
        List<Department> departments;
        public Form1() {
            InitializeComponent();
            person = new Employee {
                ID = 1,
                FullName = "John Smith",
            };
            departments = new List<Department> {
                new Department() { ID = 1, Name = "IT Department" },
                new Department() { ID = 2, Name = "Sales" },
                new Department() { ID = 3, Name = "Management" },
                new Department() { ID = 4, Name = "Support" },
                new Department() { ID = 5, Name = "Human Resources" },
                new Department() { ID = 6, Name = "Engineering" },
                new Department() { ID = 7, Name = "Shipping" },
            };
            // Populates binding sources with data.
            employeeBindingSource.DataSource = person;
            departmentBindingSource.DataSource = departments;
    
            leDepartments.Properties.DataSource = departmentBindingSource;
            leDepartments.Properties.ValueMember = "ID";
            leDepartments.Properties.DisplayMember = "Name";
            leDepartments.Properties.EditValueType = DevExpress.XtraEditors.Repository.LookUpEditValueType.ValueList;
            // Binds the editor's EditValue property to the Employee.Departments property.
            leDepartments.DataBindings.Add(new Binding("EditValue", employeeBindingSource, "Departments", true, DataSourceUpdateMode.OnPropertyChanged));
        }
    }
    
    public class Employee {
        public Employee() {
            Departments = new HashSet<int>();
        }
        public int ID { get; set; }
        public string FullName { get; set; }
        // Creates a read-only property of the HashSet<T> type.
        public HashSet<int> Departments { get; private set; }
    }
    public class Department {
        public int ID { get; set; }
        public string Name { get; set; }
    }
    

    Refer to the following help topic for more information: LookUpEdit - Enable Multiple Item Selection.

    See Also