Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
Overrule text of ComboEditor with check boxes.
posted

Hi,

 

I have an UltraComboEditor where I can select multiple values with check boxes. The text displayed is automatically generated (List of checked items separated with a comma).

 

I want to overrule this process with my own custom text.

 

How can I achieve this?

 

Thanks and kind regards,

 

Luc Verstreken

Parents
No Data
Reply
  • 69832
    Offline posted

    I have a partial solution to this problem, using the IEditorDataFilter interface (see below). This does not, however, display the custom text when the control is in edit mode. You might be able to hack that out by getting a reference to the TextBox control embedded therein, and directly setting the Text property.

    public class MultiSelectDataFilter : IEditorDataFilter
    {
        private UltraComboEditor comboEditor = null;
        private string displayText = null;

        public MultiSelectDataFilter( UltraComboEditor comboEditor, string displayText )
        {
            this.comboEditor = comboEditor;
            this.displayText = displayText;
        }
        #region IEditorDataFilter

        object IEditorDataFilter.Convert(EditorDataFilterConvertArgs conversionArgs)
        {
            switch ( conversionArgs.Direction )
            {
                case ConversionDirection.EditorToDisplay:
                case ConversionDirection.DisplayToEditor:
                    if ( this.comboEditor.CheckedItems.Count > 1 )
                    {
                        conversionArgs.Handled = true;
                        return this.displayText;
                    }  
                    break;
            }

            return conversionArgs.Value;
        }

        #endregion IEditorDataFilter
    }

Children
No Data