Text wrap in MultiColumnComboBox

3 posts, 1 answers
  1. Roberto Wenzel
    Roberto Wenzel avatar
    41 posts
    Member since:
    Sep 2012

    Posted 17 Mar 2011 Link to this post

    Hello,
    is ist possible to get long text wrapped in a MultiColumnComboBox column?
    Haven't found a clue so far.
    Thank you in advance.
    Best regards
    Roberto
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 17 Mar 2011 Link to this post

    Hi Roberto,

    Yes, you can do this by getting to the RadGridView via the EditorControl, and then setting AutoSizeRows to true and the column to WrapText

    For exmaple

    class Person
    public class Person
    {
        public Person(string name, int id, string desc)
        { this.Name = name; this.Id = id; this.Desc = desc; }
        public string Name
        { get; set; }
        public int Id
        { get; set; }
        public string Desc
        { get; set; }
    }

    In Form Load for exmaple
    List<Person> people = new List<Person>();
    for (int i = 0; i <= 101; i++)
    {
        people.Add(new Person("Name " + i, i, "Some quite long description that goes in here"));
    }
    this.radMultiColumnComboBox1.DataSource = people;
    this.radMultiColumnComboBox1.DisplayMember = "Name";
    this.radMultiColumnComboBox1.ValueMember = "Id";
    this.radMultiColumnComboBox1.MultiColumnComboBoxElement.DropDownSizingMode = Telerik.WinControls.UI.SizingMode.UpDownAndRightBottom;
    this.radMultiColumnComboBox1.MultiColumnComboBoxElement.DropDownMinSize = new Size(300, 0);
    this.radMultiColumnComboBox1.EditorControl.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
    this.radMultiColumnComboBox1.EditorControl.AutoSizeRows = true;
    this.radMultiColumnComboBox1.EditorControl.Columns["Desc"].WrapText = true;

    hope that helps, but let me know if you need more information
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Roberto Wenzel
    Roberto Wenzel avatar
    41 posts
    Member since:
    Sep 2012

    Posted 18 Mar 2011 Link to this post

    Thank you again Richard.
    Your solution works fine.
    Cheers Roberto
Back to Top