Current filter:
                                You should refresh the page.
                                  • Hi guys,

                                    I would like to use a checked lcombobox in my xaf app not a many to many relationship .

                                    example i have a requirement to select a set of available tools I would just like a combobox  to display a comma seperated string

                                    and selection list with selectable items,

                                    I have seen some examples but dont work

                                    why this is not a standard control in XAF?

                                    any idea how to do this, kinda urgent

                                    Kind regards,

                                    Paul Elliott

                                1 Solution

                                Creation Date Importance Sort by
                                Hello Paul,

                                We have a property editor showing such a combo box - CheckedListBoxStringPropertyEditor, but it is intended only for selecting property names for the Security System's member permissions. So, we cannot guarantee that it will work well in your scenario. To use it, implement the ICheckedListBoxItemsProvider interface in your business class and select the CheckedListBoxStringPropertyEditor property editor for the required String property in the Model Editor. Here is an example:

                                public class DomainObject1 : BaseObject, ICheckedListBoxItemsProvider { public DomainObject1(Session session) : base(session) { } private Type _TargetType; [ValueConverter(typeof(TypeToStringConverter))] [TypeConverter(typeof(LocalizedClassInfoTypeConverter))] [ImmediatePostData] public Type TargetType { get { return _TargetType; } set { if (SetPropertyValue("TargetType", ref _TargetType, value) && !IsLoading) { OnItemsChanged(); } } } private string _Properties; [EditorAlias(EditorAliases.CheckedListBoxEditor)] public string Properties { get { return _Properties; } set { SetPropertyValue("Properties", ref _Properties, value); } } #region ICheckedListBoxItemsProvider Members public Dictionary<object, string> GetCheckedListBoxItems(string targetMemberName) { Dictionary<object, string> properties = new Dictionary<object, string>(); if (targetMemberName == "Properties" && TargetType != null) { ITypeInfo typeInfo = XafTypesInfo.Instance.FindTypeInfo(TargetType); foreach (IMemberInfo memberInfo in typeInfo.Members) { if (memberInfo.IsVisible) { properties.Add(memberInfo.Name, CaptionHelper.GetMemberCaption(typeInfo, memberInfo.Name)); } } } return properties; } public event EventHandler ItemsChanged; protected void OnItemsChanged() { if (ItemsChanged != null) { ItemsChanged(this, new EventArgs()); } } #endregion }

                                Note that the ICheckedListBoxItemsProvider interface was implemented for our internal needs, and the capabilities of the resulting editor are limited by scenarios for which it was implemented. For example, it won't work properly in list views. We also don't have documentation for it, and the related code can be changed in the future. To avoid this risk, you can implement a custom property editor from scratch, as described in the How to implement a multi-select dropdown editor (checked combo box) ticket.

                                It is also possible to use this property editor to edit associated collections. To do this, implement a non-persistent String property in a business class with the collection, bind the property editor to this property and manage the collection based on the value of this property. See an example for WinForms here: How to bind CheckedCombobBoxEdit to the collection property.

                                We also have an example of how to implement a checked combo box editor for enumeration properties allowing multiple value selection - see How to represent an enumeration property via a drop-down box with check boxes.

                                If these property editors do not meet your needs, you can implement a custom one based on the CheckedComboBoxEdit control. Refer to the How to: Implement a Property Editor Using a Control from the XtraEditors Library topic for additional information.

                                • bbirbo 01.27.2016


                                  Can you please post a small sample working solution that demonstrates this ?
                                  I couldn't make it work.


                                • Michael (DevExpress Support) 01.28.2016
                                  @bbirbo: We need some time to create an example. We will update this ticket once it is ready.

                                • Alexey (DevExpress Support) 01.29.2016
                                  I have attached a small sample project to the answer. Just set a required type to the TargetType property and the Properties property will list all type's properties in the drop-down.