This project has moved. For the latest updates, please go here.

Custom Text for CheckComboBox based on items selected

Jan 9 at 12:36 PM
I want to customize the text in CheckComboBox Control based on the number of items selected.

If user selects all the items, then I would like to display "All Items are selected".
If multiple items are selected, I will display "x items are selected".
If only a single item is selected, I display the title of that item.

What should I do to achieve this?
Developer
Jan 10 at 5:52 PM
Hi,

Starting at v3.1, you can override the CheckComboBox.UpdateText() method to display the text you want :
 public class MyCheckComboBox : CheckComboBox
  {
    protected override void UpdateText()
    {
      if( this.SelectedItems.Count == this.Items.Count )
      {
        this.SetCurrentValue( MyCheckComboBox.TextProperty, "All Items are selected." );
      }
      else if( this.SelectedItems.Count <= 1 )
      {
        base.UpdateText();
      }
      else
      {
        this.SetCurrentValue( MyCheckComboBox.TextProperty, this.SelectedItems.Count + " items are selected." );
      }
    }
  }
――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF