This is a migrated thread and some comments may be shown as answers.

Multiselect in MultiColumnComboBox

24 Answers 902 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
S
Top achievements
Rank 1
S asked on 01 Apr 2011, 12:47 PM
Hi there @Telerik,
I'm experiencing some troubles with the MultiColumnComboBox control.

The following is my setup.
1. I load lsits of small data transfer objects containing two fields: the name of an object and the selection state of this object (selected or not selected).
2. In the nested RadGridView control I set AutoGenerateColumns to false and define two columns (one Checkbox column, which is editable, and one Texbox column, which is read-only). Both columns bind to the corresponding properties of the DTO.
3. I bind the DataSource property of the MCCB control to one such list and the control displays the information properly.
4. The nested RadGridView control has Multiselect set to true.

Now the problems:
1. Each click on a checkbox in the dropdown list closes the dropdown and does not let me check another field/row.
2. The first click on a checkbox will not raise the ValueChanged event. The next click raises the event, but with the old value (the value
prior the click).
What I need ist to be able to multiselect checkboxes and then get their current values when the dropdown closes.

What could be that wrong thing I'm doing, in order to get such musfunctioning?
Please also advise how to workaround these problems.

Many thanks in advance.

Kind regards,
Seilhardt Bogused

24 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 01 Apr 2011, 01:24 PM
Hello,

As far as I'm aware, this is desired behavior. The RadMultiColumnCombo, like the RadDropDownList is expecting to have a single value selected which is why each click closes the drop down. In my view, you need to provide this functionality in a different control

1: A RadListBox which allows for setting a selection mode of MultiSimple and MultiExtended. or...
2: A RadGridView which will be the same functionality as you are looking to provide but without the drop down
3: A RadTreeView with nodes at the same level and checkboxes turned on.

Hope this helps
Richard
0
S
Top achievements
Rank 1
answered on 01 Apr 2011, 02:15 PM
Thank you Richard for this quick answer,

unfortunatelly it does not help me further. According to your information, there is no control ready to work as I'm expecting, so I need
to program one of the existing controls to function as required...

Would subclassing/overloading the MultiColumnComboBox help me? I mean are they internal properties or methods which control the
behaviour of the dropdown container in a way I could use for the requested functionality?
OR are there other standard Telerik controls which will allow attaching custom control for displaying as a dropdown?

Many thanks in advance.

Kind regards,
Seilhardt Bogused.
0
Richard Slade
Top achievements
Rank 2
answered on 01 Apr 2011, 02:28 PM
Hello,

As the RadMultiColumnCombo has one field for a selected value (a DisplayMember and a ValueMember) then what would you be expecting as the selected item? Selecting multiple items usually happens in one of the controls that I have previously mentioned such as ListControl, GridView or TreeView.
Regards,
Richard
0
S
Top achievements
Rank 1
answered on 01 Apr 2011, 02:41 PM
Hi Richard,

It does not matter what the control's selection ist (in my case!) because I use the control bound to a list of DTOs. When e checkbox
on the nested RadGridView changes its toggled state, the corresponding object's property gets toggled too. I need only the events
"value(s) has been changed" and the "dropdown has been closed". The rest ist matter of simple LINQ.

Kind regards,
Seilhardt Bogused.
0
Richard Slade
Top achievements
Rank 2
answered on 01 Apr 2011, 03:01 PM
Hello,

You can use
this.radMultiColumnComboBox1.DropDownClosing += new Telerik.WinControls.UI.RadPopupClosingEventHandler(radMultiColumnComboBox1_DropDownClosing);
 to capture when the drop down has closed and
this.radMultiColumnComboBox1.MultiColumnComboBoxElement.SelectedValueChanged += new System.EventHandler(MultiColumnComboBoxElement_SelectedValueChanged);
 for selected value changed. Though I would still advise going with one of the other controls I mentioned.
If you can tell me a bit more about your scenario, I will try and help.
Richard
0
S
Top achievements
Rank 1
answered on 01 Apr 2011, 03:23 PM
Thanks Richard,
I'm already handling these events...

My context is as follows:

I do have a complex form where few RadGridView controls have been bound to diefferent lists of DTOs. The Usability Specification
requires there is filtering capability where the user can select from a list of criteria which elements should be used for filtering in
the bound lists (e.g. a ComboBox where the user can check more than one CheckBox to provide the filtering criteria selection).
I can't do it with a flat ListBox or RadGridView because there's no enough place on the form (and besides of this, it would look
ugly among the other controls on the form), so I need a dropdown where the list of CheckBoxes can be shown. This list should
not close when the user selects the checkboxes, but should close when the dropdown looses the input focus.

You already know the two problems I have with thie scenario...

Many thanks in advance.

Kind regards,
Seilhardt Bogused
0
Richard Slade
Top achievements
Rank 2
answered on 01 Apr 2011, 04:31 PM
Hello,

The problem with this is that if you keep the drop down open when it shouldn't be, then the user can move the form and the grid part will stay where it is (it will not move with the drop down),

I will look into a different way to achieve your functionality and let you know
Regards,
Richard
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 01 Apr 2011, 05:18 PM
Hello,

Ok, I've prepared you something using a RadSplitButton, a RadPanel and a RadGridView. The RadSplitButton contains an item that contains a panel that contains a RadGridView. This will allow you to leave it open and select what you need and then the button text will be set to the number of checked rows.

Form1.Designer.cs
namespace RadControlsWinFormsApp1
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components;
  
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
  
        #region Windows Form Designer generated code
  
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.office2010SilverTheme1 = new Telerik.WinControls.Themes.Office2010SilverTheme();
            this.radSplitButton1 = new Telerik.WinControls.UI.RadSplitButton();
            ((System.ComponentModel.ISupportInitialize)(this.radSplitButton1)).BeginInit();
            this.SuspendLayout();
            // 
            // radSplitButton1
            // 
            this.radSplitButton1.DefaultItem = null;
            this.radSplitButton1.Location = new System.Drawing.Point(48, 49);
            this.radSplitButton1.Name = "radSplitButton1";
            this.radSplitButton1.Size = new System.Drawing.Size(206, 24);
            this.radSplitButton1.TabIndex = 0;
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(432, 214);
            this.Controls.Add(this.radSplitButton1);
            this.Name = "Form1";
            this.Text = "radRibbonBar1";
            ((System.ComponentModel.ISupportInitialize)(this.radSplitButton1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
  
        }
  
        #endregion
  
        private Telerik.WinControls.Themes.Office2010SilverTheme office2010SilverTheme1;
        private Telerik.WinControls.UI.RadSplitButton radSplitButton1;
  
    }
}

Form1.cs
using System.Collections.Generic;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
using Telerik.WinControls.RadControlSpy;
  
namespace RadControlsWinFormsApp1
{
    public partial class Form1 : Form
    {
        private List<Person> people = new List<Person>();
        private RadPanel m_Panel;
        private RadGridView m_Grid;
        private System.Drawing.Size m_Size = new System.Drawing.Size(300, 200);
  
        public Form1()
        {
            InitializeComponent();
  
            people.Add(new Person("Richard", false));
            people.Add(new Person("Peter", true));
            people.Add(new Person("Chris", false));
            people.Add(new Person("Stew", true));
            people.Add(new Person("Bob", false));
            people.Add(new Person("Leisl", false));
  
            m_Grid = new RadGridView();
            m_Grid.AllowAddNewRow = false;
            m_Grid.EnableFiltering = true;
            m_Grid.ShowRowHeaderColumn = false;
            m_Grid.EnableGrouping = false;
            m_Grid.ShowFilteringRow = true;
            m_Grid.AutoSizeRows = true;
            m_Grid.DataBindingComplete += new GridViewBindingCompleteEventHandler(m_Grid_DataBindingComplete);
  
            m_Grid.DataSource = people;
            m_Panel = new RadPanel();
            m_Panel.Controls.Add(m_Grid);
            m_Grid.Dock = DockStyle.Fill;
  
            RadMenuItem item = new RadMenuItem();
            item.MaxSize = m_Size;
            this.radSplitButton1.Items.Add(item);
            this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupOpened += new RadPopupOpenedEventHandler(DropDownMenu_PopupOpened);
            this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupClosing += new RadPopupClosingEventHandler(DropDownMenu_PopupClosing);
  
            // force show to data bind
            this.radSplitButton1.DropDownButtonElement.ShowDropDown();
            this.radSplitButton1.DropDownButtonElement.HideDropDown();
        }
  
        void DropDownMenu_PopupClosing(object sender, RadPopupClosingEventArgs args)
        {
            m_Grid.EndEdit();
            SetButtonText();
        }
  
        void m_Grid_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
        {
            m_Grid.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            m_Grid.Columns["Name"].ReadOnly = true;
            m_Grid.Columns["HasBeard"].ReadOnly = false;
            m_Grid.Columns["Name"].BestFit();
            m_Grid.Columns["HasBeard"].BestFit();
            SetButtonText();
        }
  
        void DropDownMenu_PopupOpened(object sender, System.EventArgs args)
        {
            this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupElement.MaxSize = m_Size;
  
            this.radSplitButton1.Items.Clear();
            m_Panel.Size = m_Size; 
  
            RadMenuItem item = new RadMenuItem();
            item.AutoSize = false;
            item.BackColor = System.Drawing.Color.Transparent;
            item.Size = m_Panel.Size;
            item.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
            item.Children.Add(new RadHostItem(m_Panel));
            this.radSplitButton1.Items.Add(item);
        }
  
        private void SetButtonText()
        {
            int count = 0;
            foreach (GridViewRowInfo row in m_Grid.ChildRows)
            {
                if (row is GridViewDataRowInfo)
                
                    if (((bool)row.Cells["HasBeard"].Value) == true)
                    {
                        count ++;
                    }                
                }
  
            }
            this.radSplitButton1.Text = count.ToString() + " people have beards";
        }
  
  
    }
  
    public class Person
    {
        public Person(string name, bool hasBeard)
        { this.Name = name; this.HasBeard = hasBeard; }
  
        public string Name
        { get; set; }
  
        public bool HasBeard
        { get; set; }
    }
}

It needs refactoring, but the basic functionality seems to be all there.
and here is a small video of the functionality

Hope this helps. Let me know if you have any questions
RIchard
0
S
Top achievements
Rank 1
answered on 03 Apr 2011, 11:27 PM
Thanks Richard,

this really looks like what I need and I'll give it a try this Monday.
What is more important, is the fact there would be no need of any other third party component, and I could use the existing Rad-Controls.

I'll post my test results here, probably If I'm successful in implementing this functionality as UserControl I also will post the code here...

Kind regards,
Seilhardt Bogused
0
Richard Slade
Top achievements
Rank 2
answered on 04 Apr 2011, 08:58 AM
Hello,

Ok, no problem. I think this would be better as an Inherited control. If you need further help at all, just let me know. If you find this is a suitable solution for you, then please remember to mark as answer.

Thanks
Richard
0
S
Top achievements
Rank 1
answered on 04 Apr 2011, 09:31 AM
Hi Richard,

again many thanks for the really cool solution - it functions as you demonstrated.
The only caveat I still have is if it is possible to have a TextBox instead of the RadSplitButton? I want to write the names of the
selected entries, separated by a smicolon, in a text box.
I still have a workaround for this - I do schrink the RadSpinButton to show an image and the drop down arrow only and I do place
a text box aside, I then modify your method SetButtonText to write the summary in the text box.
Do you have an idea if it is possible to modify (or construct) a text box-based control to look like a dropdown combo and to function as in
your solution?

I've already marked your solution as answer.

Kind regards,
Seilhardt Bogused.
0
Richard Slade
Top achievements
Rank 2
answered on 04 Apr 2011, 10:18 AM
Hello,

Yes, this is quite straight forward to add a TextBoxElement to the RadSplitButton. I have altered my original sample as below.

using System.Collections.Generic;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
using Telerik.WinControls.RadControlSpy;
  
namespace RadControlsWinFormsApp1
{
    public partial class Form1 : Form
    {
        private List<Person> people = new List<Person>();
        private RadPanel m_Panel;
        private RadGridView m_Grid;
        private RadTextBoxElement m_TextBox;
        private System.Drawing.Size m_Size = new System.Drawing.Size(300, 200);
  
        public Form1()
        {
            InitializeComponent();
  
            RadControlSpyForm form = new RadControlSpyForm();
            form.Show();
  
            m_TextBox = new RadTextBoxElement();
            m_TextBox.TextBoxItem.ReadOnly = true;
  
  
            people.Add(new Person("Richard", false));
            people.Add(new Person("Peter", true));
            people.Add(new Person("Chris", false));
            people.Add(new Person("Stew", true));
            people.Add(new Person("Bob", false));
            people.Add(new Person("Leisl", false));
  
            m_Grid = new RadGridView();
            m_Grid.AllowAddNewRow = false;
            m_Grid.EnableFiltering = true;
            m_Grid.ShowRowHeaderColumn = false;
            m_Grid.EnableGrouping = false;
            m_Grid.ShowFilteringRow = true;
            m_Grid.AutoSizeRows = true;
            m_Grid.DataBindingComplete += new GridViewBindingCompleteEventHandler(m_Grid_DataBindingComplete);
  
            m_Grid.DataSource = people;
            m_Panel = new RadPanel();
            m_Panel.Controls.Add(m_Grid);
            m_Grid.Dock = DockStyle.Fill;
  
            RadMenuItem item = new RadMenuItem();
            item.MaxSize = m_Size;
            this.radSplitButton1.Items.Add(item);
            this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupOpened += new RadPopupOpenedEventHandler(DropDownMenu_PopupOpened);
            this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupClosing += new RadPopupClosingEventHandler(DropDownMenu_PopupClosing);
  
            // force show to data bind
            this.radSplitButton1.DropDownButtonElement.ShowDropDown();
            this.radSplitButton1.DropDownButtonElement.HideDropDown();
        }
  
        private void Form1_Load(object sender, System.EventArgs e)
        {
            // add a textbox element to the SplitButton
            m_TextBox.AutoSize = false;
            m_TextBox.Size = new System.Drawing.Size(this.radSplitButton1.DropDownButtonElement.ActionButton.Size.Width, this.radSplitButton1.DropDownButtonElement.ActionButton.Size.Height + 1);
            this.radSplitButton1.DropDownButtonElement.ActionButton.Children.Add(m_TextBox);
        }
  
        void DropDownMenu_PopupClosing(object sender, RadPopupClosingEventArgs args)
        {
            m_Grid.EndEdit();
            SetText();
        }
  
        void m_Grid_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
        {
            m_Grid.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            m_Grid.Columns["Name"].ReadOnly = true;
            m_Grid.Columns["HasBeard"].ReadOnly = false;
            m_Grid.Columns["Name"].BestFit();
            m_Grid.Columns["HasBeard"].BestFit();
            SetText();
        }
  
        void DropDownMenu_PopupOpened(object sender, System.EventArgs args)
        {
            this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupElement.MaxSize = m_Size;
  
            this.radSplitButton1.Items.Clear();
            m_Panel.Size = m_Size; 
  
            RadMenuItem item = new RadMenuItem();
            item.AutoSize = false;
            item.BackColor = System.Drawing.Color.Transparent;
            item.Size = m_Panel.Size;
            item.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
            item.Children.Add(new RadHostItem(m_Panel));
            this.radSplitButton1.Items.Add(item);
        }
  
        private void SetText()
        {
            string people = "";
            foreach (GridViewRowInfo row in m_Grid.ChildRows)
            {
                if (row is GridViewDataRowInfo)
                
                    if (((bool)row.Cells["HasBeard"].Value) == true)
                    {
                        people = people + row.Cells["Name"].Value.ToString() + ";";
                    }                
                }
  
            }
  
            if (people.Length > 0)
            {
               people = people.Remove(people.Length-1, 1);
               this.m_TextBox.Text = people + " have beards";
            }
            else
            {
                this.m_TextBox.Text = "nobody has a beard";
            }
  
        }
  
    }
  
    public class Person
    {
        public Person(string name, bool hasBeard)
        { this.Name = name; this.HasBeard = hasBeard; }
  
        public string Name
        { get; set; }
  
        public bool HasBeard
        { get; set; }
    }
}

Hope that help, but let me know if you need more information
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 04 Apr 2011, 11:01 AM
Hi,

Here is also a slight improvement to remove the padding which makes the drop down look a little neater.

void DropDownMenu_PopupOpened(object sender, System.EventArgs args)
{
    this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupElement.MaxSize = m_Size;
    this.radSplitButton1.Items.Clear();
    m_Panel.Size = m_Size;
    RadMenuItem item = new RadMenuItem();
    item.AutoSize = false;
    Padding itemPadding = new System.Windows.Forms.Padding(0);
    item.Padding = itemPadding;
    item.BorderThickness = itemPadding;
    item.Size = m_Panel.Size;
    item.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
    item.Children.Add(new RadHostItem(m_Panel));
    this.radSplitButton1.Items.Add(item);
}

Richard
0
S
Top achievements
Rank 1
answered on 05 Apr 2011, 11:24 AM
Thanks Richard for this implementation!

I've slightly adapted it to better suit my requirements, but even your original solution does schow left-side and top-side a 2 pixel
(blue in my case, because of the default theme) borders. This is comming from the panel and GridView borders and I could not find
property or setting which will disable them.

My current workarround is to set the panel's Location to a point of (-1, -2). This is ugly solution, because I need to do pixel-magic
in order to place the panel correctly in the dropdown container...

Do you have a hint how to disable those borders?

Many thanks in advance.

Kind regards,
Seilhardt Bogused
0
Richard Slade
Top achievements
Rank 2
answered on 05 Apr 2011, 01:37 PM
Hello,

Have you tried the amendment above? This removes the padding that may be what you are seeing.
Regards,
Richard
0
S
Top achievements
Rank 1
answered on 05 Apr 2011, 02:41 PM
Hi Richard,

thanks for the reminder, but I'm already using the improvement you suggested yesterday. The padding does not affect in any way the
presence of the borders. I'm attaching screenshot of the form where you can see the effect.

As I said, I've managed to overcome this situation using positioning outside the container (Location is -1, -2, the Size is the original m_Size with Height + 1), but this is ugly and not maintaineable.

Your siggestions are much more than welcome.
Many thanks in advance.

Kind regards,
Seilhardt Bogused.
0
S
Top achievements
Rank 1
answered on 05 Apr 2011, 02:54 PM
Hi again,

I've noticed I've commented out this code:

RadControlSpyForm form = new RadControlSpyForm();
form.Show();

from your original solution. Could it be this mystic form, which I don't have, doing the special border thing?
What form is RadControlSpyForm for and what is it doing?

Many thanks in advance.

Kind regards,
Seilhardt Bogused


0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 05 Apr 2011, 03:42 PM
Hello,

This is a little better. The panel is not actually needed, but it's not that that is causing the border. I have made it a little better but still not perfect. If I can get it spot on, I'll let you know.

using System.Collections.Generic;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
  
namespace RadControlsWinFormsApp1
{
    public partial class Form1 : Form
    {
  
  
        private List<Person> people = new List<Person>();
        private RadGridView m_Grid;
        private RadTextBoxElement m_TextBox;
        private System.Drawing.Size m_Size = new System.Drawing.Size(300, 200);
  
        public Form1()
        {
            InitializeComponent();
  
  
            m_TextBox = new RadTextBoxElement();
            m_TextBox.TextBoxItem.ReadOnly = true;
  
  
            people.Add(new Person("Richard", false));
            people.Add(new Person("Peter", true));
            people.Add(new Person("Chris", false));
            people.Add(new Person("Stew", true));
            people.Add(new Person("Bob", false));
            people.Add(new Person("Leisl", false));
  
            m_Grid = new RadGridView();
            m_Grid.AllowAddNewRow = false;
            m_Grid.EnableFiltering = true;
            m_Grid.ShowRowHeaderColumn = false;
            m_Grid.EnableGrouping = false;
            m_Grid.ShowFilteringRow = true;
            m_Grid.AutoSizeRows = true;
            m_Grid.DataBindingComplete += new GridViewBindingCompleteEventHandler(m_Grid_DataBindingComplete);
  
            m_Grid.DataSource = people;
  
            RadMenuItem item = new RadMenuItem();
            item.MaxSize = m_Size;
            this.radSplitButton1.Items.Add(item);
            this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupOpened += new RadPopupOpenedEventHandler(DropDownMenu_PopupOpened);
            this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupClosing += new RadPopupClosingEventHandler(DropDownMenu_PopupClosing);
  
            // force show to data bind 
            this.radSplitButton1.DropDownButtonElement.ShowDropDown();
            this.radSplitButton1.DropDownButtonElement.HideDropDown();
  
            this.Load +=new System.EventHandler(Form1_Load);
        }
  
        private void Form1_Load(object sender, System.EventArgs e)
        {
            // add a textbox element to the SplitButton 
            m_TextBox.AutoSize = false;
            m_TextBox.Size = new System.Drawing.Size(this.radSplitButton1.DropDownButtonElement.ActionButton.Size.Width, this.radSplitButton1.DropDownButtonElement.ActionButton.Size.Height + 1);
            this.radSplitButton1.DropDownButtonElement.ActionButton.Children.Add(m_TextBox);
        }
  
        void DropDownMenu_PopupClosing(object sender, RadPopupClosingEventArgs args)
        {
            m_Grid.EndEdit();
            SetText();
        }
  
        void m_Grid_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
        {
            m_Grid.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
            m_Grid.Columns["Name"].ReadOnly = true;
            m_Grid.Columns["HasBeard"].ReadOnly = false;
            m_Grid.Columns["Name"].BestFit();
            m_Grid.Columns["HasBeard"].BestFit();
            SetText();
        }
  
        void DropDownMenu_PopupOpened(object sender, System.EventArgs args)
        {
            this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupElement.MaxSize = m_Size;
            this.radSplitButton1.Items.Clear();
  
            RadMenuItem item = new RadMenuItem();
            item.AutoSize = false;
            Padding itemPadding = new System.Windows.Forms.Padding(0);
            item.Padding = itemPadding;
            item.BorderPrimitive.BorderThickness = itemPadding;
            item.BorderPrimitive.TopWidth = 0;
            item.BorderPrimitive.ShouldPaint = false;
            item.Size = m_Size;
  
  
            item.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
            item.Children.Add(new RadHostItem(m_Grid));
            this.radSplitButton1.Items.Add(item); 
  
        }
  
        private void SetText()
        {
            string people = "";
            foreach (GridViewRowInfo row in m_Grid.ChildRows)
            {
                if (row is GridViewDataRowInfo)
                {
                    if (((bool)row.Cells["HasBeard"].Value) == true)
                    {
                        people = people + row.Cells["Name"].Value.ToString() + ";";
                    }
                }
  
            }
  
            if (people.Length > 0)
            {
                people = people.Remove(people.Length - 1, 1);
                this.m_TextBox.Text = people + " have beards";
            }
            else
            {
                this.m_TextBox.Text = "nobody has a beard";
            }
  
        }
  
    }
  
    public class Person
    {
        public Person(string name, bool hasBeard)
        { this.Name = name; this.HasBeard = hasBeard; }
  
        public string Name
        { get; set; }
  
        public bool HasBeard
        { get; set; }
    }
}

The RadControlSpy is a tool that allows you to view and alter the properties of control at runtime and is useful for debugging. Have a look at my blog post on RadControlSpy here
Hope that helps
Richard
0
Jason
Top achievements
Rank 1
answered on 04 Oct 2011, 05:31 PM
Hi Richard,

Thanks for the cool control. I'm trying to use this multiselect combobox as an inline control in a RadGrid. I'm using this in combination with the documentation at http://www.telerik.com/help/winforms/gridview-editors-using-custom-editors.html

I'm having issues where after adding the data source for the m_Grid, the databinding event doesnt fire, and the grid still shows 0 columns, 0 rows. I'm still looking into it, but I was wondering if you could provide any assistance in this matter.It seems that I can't get the grid of the inline control to populate.

Thanks,
Jason
0
Svett
Telerik team
answered on 06 Oct 2011, 03:38 PM
Hello Jason,

You do not need to create a custom editor to embed RadMultiColumnComboBox in RadGridView. You should use a GridViewMultiComboBoxColumn column. You can read more about it in the online documentation.

Greetings,
Svett
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Jason
Top achievements
Rank 1
answered on 07 Oct 2011, 03:27 PM
But it's not a multicolumncombobox I need. I need this custom control (as described by Richard) that let's you select multiple items before closing. The multicolumncombobox doesn't allow this I thought.
0
Svett
Telerik team
answered on 11 Oct 2011, 08:28 AM
Hi Jason,

The solution proposed by Richard is a good alternative based on RadControls for Winforms. If you need further assistance for adopting the solution in your project, feel free to ask in our forums.

All the best,
Svett
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

0
Rafnas
Top achievements
Rank 1
answered on 19 Apr 2018, 10:13 AM

hi @Svett,

I am using RadMultiColumnComboBox with check box added, can you tell me how can i get checked items values from that control

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 19 Apr 2018, 11:52 AM
Hello, Rafnas,   

By default, for a Boolean property in the DataSource the popup RadGridView will auto-generate a GridViewCheckBoxColumn. If you need to extract the checked row in RadMultiColumnComboBox, it would be necessary to iterate the EditorControl.Rows collection and check the relevant cell's value for each row in order to determine if it is checked or not. Thus, you can fill a collection of all checked rows (objects).

I would recommend you to have a look at our Demo application >> MultiColumnComboBox example and check the Multiple Selection option on the right. This will enable a checkbox column at the first position and the user will be allowed to check multiple items which are displayed in the text area. So you can easily extract the checked rows by the Text of RadMultiColumnComboBox.
 
I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MultiColumn ComboBox
Asked by
S
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
S
Top achievements
Rank 1
Jason
Top achievements
Rank 1
Svett
Telerik team
Rafnas
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or