Completed
Last Updated: 19 Jun 2017 12:05 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 20 Jan 2017 07:47
Category: MultiColumnCombo
Type: Bug Report
1
FIX. RadMultiColumnComboBox - incorrect SelectedValue when entering the exact string in the editable part
To reproduce: 

            DataTable dt = new DataTable();

            dt.Columns.Add("ID");
            dt.Columns.Add("Description");

            dt.Rows.Add(new object[] { "0", "Low" });
            dt.Rows.Add(new object[] { "1", "Medium" });
            dt.Rows.Add(new object[] { "2", "High" });
            radMultiColumnComboBox1.DisplayMember = "ID";
            radMultiColumnComboBox1.ValueMember = "ID";
            radMultiColumnComboBox1.DataSource = dt;
            radMultiColumnComboBox1.SelectedValue = "1";

 this.radMultiColumnComboBox1.SelectedValueChanged+=radMultiColumnComboBox1_SelectedValueChanged;

        private void radMultiColumnComboBox1_SelectedValueChanged(object sender, EventArgs e)
        {
            Console.WriteLine(this.radMultiColumnComboBox1.SelectedValue);
        }

If you type 2 in the editable part, the SelectedValue is not changed as in the previous version.

Workaround:

public class MyRadMultiColumnComboBox : RadMultiColumnComboBox
{
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadMultiColumnComboBox).FullName;
        }
    }

    protected override RadMultiColumnComboBoxElement CreateMultiColumnComboBoxElement()
    {
        return new MyRadMultiColumnComboBoxElement();
    }
}

public class MyRadMultiColumnComboBoxElement : RadMultiColumnComboBoxElement
{
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(RadMultiColumnComboBoxElement);
        }
    }

    protected override void SetActiveItem(string text)
    {
        int rowIndex = this.FindItemIndexExact(text);

        if (rowIndex != -1)
        {
            this.EditorControl.CurrentRow = this.EditorControl.Rows[rowIndex];
            this.textBox.SelectionStart = this.textBox.Text.Length;
        }
    }
}
0 comments