To reproduce: please refer to the attached sample project and try to enter some numeric value or clear the existing one. Then open the popup. Workaround: use the custom filtering that RadGridView offers http://docs.telerik.com/devtools/winforms/gridview/filtering/custom-filtering this.radMultiColumnComboBox1.AutoFilter = true; FilterDescriptor filter = new FilterDescriptor(); filter.PropertyName = this.radMultiColumnComboBox1.DisplayMember; filter.Operator = FilterOperator.Contains; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.FilterDescriptors.Add(filter); this.radMultiColumnComboBox1.EditorControl.EnableCustomFiltering = true; this.radMultiColumnComboBox1.EditorControl.CustomFiltering += EditorControl_CustomFiltering; string search = string.Empty; private void EditorControl_CustomFiltering(object sender, Telerik.WinControls.UI.GridViewCustomFilteringEventArgs e) { search = this.radMultiColumnComboBox1.MultiColumnComboBoxElement.EditorElement.Text; if (search != string.Empty) { e.Handled = true; e.Visible = e.Row.Cells[this.radMultiColumnComboBox1.DisplayMember].Value.ToString().Contains(search); } else { e.Handled = false; } }
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; } } }
How to reproduce: check the attached project and video Workaround: create a custom RadMultiColumnComboBoxElement Public Class MyRadMultiColumnComboBox Inherits RadMultiColumnComboBox Public Overrides Property ThemeClassName As String Get Return GetType(RadMultiColumnComboBox).FullName End Get Set(value As String) MyBase.ThemeClassName = value End Set End Property Protected Overrides Function CreateMultiColumnComboBoxElement() As RadMultiColumnComboBoxElement Return New MyRadMultiColumnComboBoxEleemnt() End Function End Class Class MyRadMultiColumnComboBoxEleemnt Inherits RadMultiColumnComboBoxElement Protected Overrides ReadOnly Property ThemeEffectiveType() As Type Get Return GetType(RadMultiColumnComboBoxElement) End Get End Property Protected Overrides Sub SetActiveItem(item As String) Dim rowIndex As Integer = Me.FindItemIndexExact(Text) If rowIndex <> -1 Then Me.textBox.SelectionStart = Me.textBox.Text.Length End If End Sub End Class
Workaround: create a custom RadMultiColumnComboBox control with a custom element. You can also check the attached project. 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 ProcessKeyDown(object sender, KeyEventArgs e) { base.ProcessKeyDown(sender, e); if (this.IsPopupOpen && (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.PageUp)) { this.EditorControl.GridBehavior.ProcessKey(e); } } }
When you set the DropDownHeight property to a big number that exceeds the screen's height, the applied values is SystemInformation.WorkingArea.Height - 100 . However, it should be only SystemInformation.WorkingArea.Height. These 100 pixels shouldn't be lost. NOTE: the same behavior is observed with DropDownWidth as well. Workaround: Public Class CustomMultiColumn Inherits RadMultiColumnComboBox Protected Overrides Function CreateMultiColumnComboBoxElement() As RadMultiColumnComboBoxElement Return New CustomRadMultiColumnComboBoxElement() End Function Public Overrides Property ThemeClassName As String Get Return GetType(RadMultiColumnComboBox).FullName End Get Set(value As String) MyBase.ThemeClassName = value End Set End Property End Class Public Class CustomRadMultiColumnComboBoxElement Inherits RadMultiColumnComboBoxElement Protected Overrides Function GetPopupSize(popup As RadPopupControlBase, measure As Boolean) As Drawing.Size Dim s As Size = MyBase.GetPopupSize(popup, measure) Return New Size(s.Width, Math.Min(SystemInformation.WorkingArea.Height, Me.DropDownHeight)) End Function Protected Overrides ReadOnly Property ThemeEffectiveType As Type Get Return GetType(RadMultiColumnComboBoxElement) End Get End Property End Class
To reproduce: public Form1() { InitializeComponent(); DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name", typeof(string)); for (int i = 0; i < 20; i++) { dt.Rows.Add(i, "Item" + i); } this.radMultiColumnComboBox1.DataSource = dt; this.radMultiColumnComboBox1.DisplayMember = "Name"; this.radMultiColumnComboBox1.ValueMember = "Id"; this.radMultiColumnComboBox1.SelectedValueChanged += radMultiColumnComboBox1_SelectedValueChanged; } private void radMultiColumnComboBox1_SelectedValueChanged(object sender, EventArgs e) { if (this.radMultiColumnComboBox1.SelectedIndex > -1) { MessageBox.Show("Test"); } } NOTE: If you use a RadMessageBox, after showing the message the first time, the popup can't be closed because InvalidOperationException is thrown. Workaround: show the message box in the RadMultiColumnComboBox.DropDownClosed event.
To reproduce: - Open the attached project. - Type a text so there are no results in the drop down. - Press Enter. - Click the arrow button. Workaround: private void RadMultiColumnComboBox1_DropDownOpened1(object sender, EventArgs e) { if (radMultiColumnComboBox1.Text == "") { radMultiColumnComboBox1.EditorControl.FilterDescriptors.Clear(); CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor(); compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Drug", FilterOperator.StartsWith, "")); compositeFilter.FilterDescriptors.Add(new FilterDescriptor("Name", FilterOperator.StartsWith, "")); compositeFilter.LogicalOperator = FilterLogicalOperator.Or; radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add(compositeFilter); } }
Steps to reproduce: 1. Select the radMultiColumnsComboBox1 at Design time 2. Press F4 for showing Properties 3. Open Columns editor (GridViewDataColumn Collection Editor) 4. Try to add a column Error Message: Cannot create an instance of the abstract class or interface 'Telerik.WinControls.UI.GridViewDataColumn' because it is an abstract class.
To reproduce: Repository commonRepository = new Repository(); public Form1() { InitializeComponent(); InitializeDropDown(); this.radMultiColumnComboBox1.DropDownMinSize = new Size(1100, 400); this.radMultiColumnComboBox1.EditorControl.ViewCellFormatting += EditorControl_ViewCellFormatting; } private void EditorControl_ViewCellFormatting(object sender, CellFormattingEventArgs e) { if (e.Row is GridViewDataRowInfo && e.CellElement is GridRowHeaderCellElement) { e.CellElement.Text = e.RowIndex.ToString(); } } public class Instrument { public string Isin { get; set; } public string Description { get; set; } public string AlphaCode { get; set; } public string MicMarketplaceCode { get; set; } public string WorpMarketPlaceDescription { get; set; } public string InstrumentType { get; set; } public string DerivateIsin { get; set; } public int Order { get; set; } } public class Repository { public BindingList<Instrument> GetInstruments() { Random rand = new Random(); BindingList<Instrument> list = new BindingList<Instrument>(); for (int i = 0; i < 80000; i++) { list.Add(new Instrument() { Isin = Guid.NewGuid().ToString(), Description = "Description" + i, AlphaCode = "Code" + i, MicMarketplaceCode = "MicCode" + i, WorpMarketPlaceDescription = "MPdescription" + i, InstrumentType = "Type" + i % 3, DerivateIsin = Guid.NewGuid().ToString(), Order = rand.Next(1, 100) }); } return list; } } public void InitializeDropDown() { var ui = TaskScheduler.FromCurrentSynchronizationContext(); Task.Factory.StartNew(() => { var result = commonRepository.GetInstruments(); return result; }).ContinueWith(res => { if (res.IsCompleted) { this.radMultiColumnComboBox1.DisplayMember = "Description"; this.radMultiColumnComboBox1.ValueMember = "Isin"; this.radMultiColumnComboBox1.AutoFilter = true; this.radMultiColumnComboBox1.DataSource = res.Result; CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor(); FilterDescriptor code = new FilterDescriptor("Isin", FilterOperator.Contains, ""); FilterDescriptor description = new FilterDescriptor("Description", FilterOperator.Contains, ""); FilterDescriptor alphaCode = new FilterDescriptor("AlphaCode", FilterOperator.Contains, ""); FilterDescriptor micMarketplaceCode = new FilterDescriptor("MicMarketplaceCode", FilterOperator.Contains, ""); FilterDescriptor worpMarketPlaceDescription = new FilterDescriptor("WorpMarketPlaceDescription", FilterOperator.Contains, ""); FilterDescriptor instrumentType = new FilterDescriptor("InstrumentType", FilterOperator.Contains, ""); FilterDescriptor derivateIsin = new FilterDescriptor("DerivateIsin", FilterOperator.Contains, ""); compositeFilter.FilterDescriptors.Add(code); compositeFilter.FilterDescriptors.Add(description); compositeFilter.FilterDescriptors.Add(alphaCode); compositeFilter.FilterDescriptors.Add(micMarketplaceCode); compositeFilter.FilterDescriptors.Add(worpMarketPlaceDescription); compositeFilter.FilterDescriptors.Add(instrumentType); compositeFilter.FilterDescriptors.Add(derivateIsin); compositeFilter.LogicalOperator = FilterLogicalOperator.Or; this.radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add(compositeFilter); this.radMultiColumnComboBox1.EditorControl.BestFitColumns(); for (int i = 0; i < this.radMultiColumnComboBox1.EditorControl.Columns.Count; i++) { var column = this.radMultiColumnComboBox1.EditorControl.Columns[i]; switch (column.Name) { case "Isin": column.HeaderText = "Header Isin"; column.Width = 120; break; case "Description": column.HeaderText = "Header Description"; break; case "AlphaCode": column.HeaderText = "Header AlphaCode"; break; case "MicMarketplaceCode": column.HeaderText = "Header MicMarketplaceCode"; break; case "WorpMarketPlaceDescription": column.HeaderText = "Header WorpMarketPlaceDescription"; break; case "InstrumentType": column.HeaderText = "Header InstrumentType"; break; case "DerivateIsin": column.HeaderText = "Header DerivateIsin"; break; case "Order": column.IsVisible = false; break; } } this.radMultiColumnComboBox1.SelectedItem = null; this.radMultiColumnComboBox1.Text = "Instrument"; this.radMultiColumnComboBox1.ForeColor = Color.Gray; this.radMultiColumnComboBox1.MultiColumnComboBoxElement.DropDownWidth = 550; } else { RadMessageBox.Show(res.Exception.Message); } }, ui); } Workaround: use custom filtering instead of CompositeFilterDescriptor: FilterDescriptor filter = new FilterDescriptor(); filter.PropertyName = this.radMultiColumnComboBox1.DisplayMember; filter.Operator = FilterOperator.Contains; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.FilterDescriptors.Add(filter); this.radMultiColumnComboBox1.EditorControl.EnableCustomFiltering = true; this.radMultiColumnComboBox1.EditorControl.CustomFiltering += EditorControl_CustomFiltering; private void EditorControl_CustomFiltering(object sender, GridViewCustomFilteringEventArgs e) { string searchText = this.radMultiColumnComboBox1.MultiColumnComboBoxElement.EditorElement.Text; if (searchText != string.Empty) { Instrument instrument = e.Row.DataBoundItem as Instrument; e.Handled = true; e.Visible = instrument.Isin.Contains(searchText) || instrument.Description.Contains(searchText) || instrument.AlphaCode.Contains(searchText) || instrument.MicMarketplaceCode.Contains(searchText) || instrument.WorpMarketPlaceDescription.Contains(searchText) || instrument.InstrumentType.Contains(searchText) || instrument.DerivateIsin.Contains(searchText); } }
To reproduce: - Set the AutoFileter property to true. - Add filter descriptor; - Start the application and type something in the control - you just need to filter the values so more than one entry is available in the drop down. - Press Tab or click on other control. - You will notice that the selected value is set, but the text is not synchronized. Workaround: void radMultiColumnComboBox1_Validated(object sender, EventArgs e) { if (radMultiColumnComboBox1.SelectedValue != null) { string text = radMultiColumnComboBox1.EditorControl.CurrentRow.Cells[radMultiColumnComboBox1.DisplayMember].Value.ToString(); if (text != radMultiColumnComboBox1.Text) { radMultiColumnComboBox1.Text = text; } } }
To reproduce: - Ty some text so the items in the drop down are filtered. - Directly press enter (this should select the first item in the drop down) - The selected value is updated however the text is not. Workaround: Private Sub cbo_SelectedValueChanged(sender As Object, e As EventArgs) Handles RadMultiColumnComboBox1.SelectedValueChanged, RadMultiColumnComboBox2.SelectedValueChanged, RadMultiColumnComboBox3.SelectedValueChanged Dim cbo As RadMultiColumnComboBox = sender If bLoading = False AndAlso cbo.Text <> CType(cbo.SelectedItem, Telerik.WinControls.UI.GridViewDataRowInfo).Cells(cbo.DisplayMember).Value Then cbo.Text = CType(cbo.SelectedItem, Telerik.WinControls.UI.GridViewDataRowInfo).Cells(cbo.DisplayMember).Value End If End Sub
Workaround: 1. Position the RadMultiColumnComboBox control and instead of setting the Dock property to Fill, anchor the it on all four sides. Alternatively: 2. Set the Dock property to Fill, but also set a MinimumSize of the column defining a height
To reproduce: - Add columns to the control manually. - Bind the control. Make sure that the FieldNames are different from the column names. - Start the application and select a value. Retrieve he value upon button click. Workaround: Use equal names.
To reproduce: - Bind the control to a binding list. - Add and then remove items at runtime. Workaround: radMultiColumnComboBox1.EditorControl.BeginUpdate(); list.RemoveAt(0); radMultiColumnComboBox1.EditorControl.EndUpdate();
Workaround: Cancel CurrentRowChanging event if Text is empty: this.radMultiColumnComboBox1.EditorControl.CurrentRowChanging += EditorControl_CurrentRowChanging; void EditorControl_CurrentRowChanging(object sender, Telerik.WinControls.UI.CurrentRowChangingEventArgs e) { e.Cancel = string.IsNullOrEmpty(this.radMultiColumnComboBox1.Text) && this.radMultiColumnComboBox1.MultiColumnComboBoxElement.ArrowButton.IsPressed; }
To reproduice: 1. Add mccb and bind it: Random random = new Random(); DataTable dataTable = new DataTable(); dataTable.Columns.Add("ID", typeof(int)); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Bool", typeof(bool)); dataTable.Columns.Add("DateColumn", typeof(DateTime)); for (int i = 0; i < 20; i++) { dataTable.Rows.Add(i, "Row " + i, random.Next(10) > 5 ? true : false, DateTime.Now.AddDays(i)); } this.radMultiColumnComboBox1.DataSource = dataTable; this.radMultiColumnComboBox1.DisplayMember = "Name"; this.radMultiColumnComboBox1.ValueMember = "Name"; 2. Add filter and subscribe to the event: radMultiColumnComboBox1.AutoFilter = true; FilterDescriptor filter = new FilterDescriptor(); filter.PropertyName = "Name"; filter.Operator = FilterOperator.Contains; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.FilterDescriptors.Add(filter); radMultiColumnComboBox1.SelectedIndexChanged += radMultiColumnComboBox1_SelectedIndexChanged; void radMultiColumnComboBox1_SelectedIndexChanged(object sender, EventArgs e) { Console.WriteLine(string.Format("Row changed, current Name = {0}", radMultiColumnComboBox1.EditorControl.Rows[radMultiColumnComboBox1.SelectedIndex].Cells["Name"].Value)); } 3. Start the app the selected row is "Row 0". Type in "2", the popup will open showing rows "Row 2" and "Row 12". At this point, pressing Esc or moving the focus away from the control selected Row 2, while it shouldn't.
To reproduce: - Add bound MCCB to a form. - Open the form at design time. - Add a control to the form and resize it. - Start the application and and then close the form. - You will get the following error "The designer loader did not provide a root component but has not indicated why".
To reproduce: 1. Add a RadMultiColumnComboBox and set up filtering. 2. Start typing in order to filter all the rows. 3. Click somewhere. As a result the RadMultiColumnComboBox will loose focus. If you try to get the SelectedIndex or SelectedValue you will notice that the first row in the popup grid is current. It is expected to have no selected row as the entered text does not match any row. Workaround: public class CustomRadMultiColumnComboBox : RadMultiColumnComboBox { protected override void OnLostFocus(EventArgs e) { int currentIndex = this.SelectedIndex; base.OnLostFocus(e); this.SelectedIndex = currentIndex; } public override string ThemeClassName { get { return typeof(RadMultiColumnComboBox).FullName; } } }
To reproduce: Add a RadMultiColumnComboBox with two rows. Open the dropdown, you will see no scrollbars, open it again and scrollbars will be visible. Workaround: Use the following custom class: public class MCCB : RadMultiColumnComboBox { protected override RadMultiColumnComboBoxElement CreateMultiColumnComboBoxElement() { return new MCCBElement(); } } public class MCCBElement : RadMultiColumnComboBoxElement { protected override Size GetPopupSize(RadPopupControlBase popup, bool measure) { Size baseSize = base.GetPopupSize(popup, measure); RadScrollBarElement hScrollBarElement = this.EditorControl.TableElement.HScrollBar; baseSize.Height += (int)hScrollBarElement.ControlBoundingRectangle.Size.Height; return baseSize; } protected override Type ThemeEffectiveType { get { return typeof(RadMultiColumnComboBoxElement); } } }
To reproduce: Add a RadMultiColumnComboBox with one row. Open and close the dropdown, you will see that the scrollbars will show and hide with every openning Workaround: Use the following class: public class MCCB : RadMultiColumnComboBox { protected override RadMultiColumnComboBoxElement CreateMultiColumnComboBoxElement() { return new MCCBElement(); } } public class MCCBElement : RadMultiColumnComboBoxElement { protected override Size GetPopupSize(RadPopupControlBase popup, bool measure) { Size baseSize = base.GetPopupSize(popup, measure); RadScrollBarElement hScrollBarElement = this.EditorControl.TableElement.HScrollBar; baseSize.Height += (int)hScrollBarElement.ControlBoundingRectangle.Size.Height; return baseSize; } protected override Type ThemeEffectiveType { get { return typeof(RadMultiColumnComboBoxElement); } } }