Use the following code and try to scroll item by item with the mouse wheel:
public RadForm1()
{
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.DisplayMember = "Name";
this.radMultiColumnComboBox1.ValueMember = "Id";
this.radMultiColumnComboBox1.DataSource = dt;
this.radMultiColumnComboBox1.ScrollOnMouseWheel = true;
this.radMultiColumnComboBox1.SelectedValueChanged+=radMultiColumnComboBox1_SelectedValueChanged;
}
private void radMultiColumnComboBox1_SelectedValueChanged(object sender, EventArgs e)
{
Console.WriteLine("Value: "+this.radMultiColumnComboBox1.SelectedValue);
}
Expected behavior: one item is scrolled at a time
Actual behavior: two items are scrolled at a time
Note: RadDropDownList behaves as expected.
- Add a RadMultiColumnComboBox and populate it with data.
- Hide most of the columns.
- Enable the AutoSizeDropDownToBestFit property
Note: the issue is reproducible with ControlDefault, Office2019Light, Desert. But it is NOT reproducible with Fluent
private void RadForm1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'nwindDataSet.Orders' table. You can move, or remove it, as needed.
this.ordersTableAdapter.Fill(this.nwindDataSet.Orders);
this.radMultiColumnComboBox1.DisplayMember = "OrderID";
this.radMultiColumnComboBox1.ValueMember = "OrderID";
this.radMultiColumnComboBox1.DataSource = ((DataSet)ordersBindingSource.DataSource).Tables[0].AsEnumerable().Reverse().Take(5);
this.radMultiColumnComboBox1.UseCompatibleTextRendering = false;
foreach (GridViewColumn col in this.radMultiColumnComboBox1.EditorControl.Columns)
{
if (!col.Name.Contains("ID") && !col.Name.Contains("OrderDate"))
{
col.IsVisible = false;
}
}
this.radMultiColumnComboBox1.AutoSizeDropDownColumnMode = BestFitColumnMode.AllCells;
this.radMultiColumnComboBox1.AutoSizeDropDownToBestFit = true;
return;
}
Expected result:
Actual result:
Workaround: instead of hiding the redundant columns, you can remove them:
List<string> columnNames = new List<string>();
foreach (GridViewColumn col in this.radMultiColumnComboBox1.EditorControl.Columns)
{
if (!col.Name.Contains("ID") && !col.Name.Contains("OrderDate"))
{
columnNames.Add(col.Name);
//col.IsVisible = false;
}
}
while (columnNames.Count>0)
{
this.radMultiColumnComboBox1.Columns.Remove(columnNames[0]);
columnNames.RemoveAt(0);
}
This scenario is reproducible when the MCCB dropdown has 1 item. To disable the selection of the row we can set the EditorControl.CurrentRow to null. However, when the dropdown is open the Text property is set to the first row.
This issue is reproducible only in .NET 6. It works OK in .NET 4.8.
Use the following code snippet:
public RadForm1()
{
InitializeComponent();
List<Student> collectionOfStudents = new List<Student>();
collectionOfStudents.Add(new Student(0, "Peter", "A+"));
collectionOfStudents.Add(new Student(1, "John", "D-"));
collectionOfStudents.Add(new Student(2, "Antony", "B+"));
collectionOfStudents.Add(new Student(3, "David", "A-"));
collectionOfStudents.Add(new Student(4, "John", "D-"));
this.radMultiColumnComboBox1.DisplayMember = "Name";
this.radMultiColumnComboBox1.ValueMember = "Id";
this.radMultiColumnComboBox1.DataSource = collectionOfStudents;
this.radMultiColumnComboBox1.AutoCompleteMode = AutoCompleteMode.Append;
}
public class Student
{
int m_id;
string m_name;
string m_grade;
public Student(int m_id, string m_name, string m_grade)
{
this.m_id = m_id;
this.m_name = m_name;
this.m_grade = m_grade;
}
public int Id
{
get
{
return m_id;
}
set
{
m_id = value;
}
}
public string Name
{
get
{
return m_name;
}
set
{
m_name = value;
}
}
public string Grade
{
get
{
return m_grade;
}
set
{
m_grade = value;
}
}
}
Type "David" in the editor and hit Backspace:
Expected: every Backspace hitting should delete the last character:
Actual: it is not possible to delete the text:
Workaround:
this.radMultiColumnComboBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
Use attached to reproduce.
Any chance for an updated MCCB with EL like the new Textboxes?
Thanks,
_D
To reproduce use the following code snippet and press the Enter key on group header row:
public RadForm1()
{
InitializeComponent();
GroupDescriptor descriptor = new GroupDescriptor();
descriptor.GroupNames.Add("CategoryName", ListSortDirection.Ascending);
this.radMultiColumnComboBox1.EditorControl.GroupDescriptors.Add(descriptor);
this.radMultiColumnComboBox1.EditorControl.EnableGrouping = true;
this.radMultiColumnComboBox1.EditorControl.ShowGroupedColumns = true;
}
To reproduce: - When the filter is set to contains the item is different than the item is selected from the drop-down and the text is taken from the append functionality. Workaround Either change the filter to StarrtsWith or remove the suggest functionality.
Using AutoCompleteMode.SuggestAppend caused other issues and I changed it to Suggest.
In the example program I provided if I type in "meadows " meadows and a space I should get the following Suggested List.
SUGGESTED LIST
Meadows Green
However I get " Meadows" selected with a space at the front of the word.
Sample program that illustrates the issue can be downloaded from here: https://www.dropbox.com/s/8qxhmxai0y4w7qg/FilterMultiColumn.zip?dl=0
Please refer to the attached sample project and follow the steps from the gif file.
1) User does a search operation
2) BackgroundWorker does its task and finishes at some point, then set defaults to select the first result.
3) User selects a different result row.
4) Selected record still indicates and points to the first result.
Workaround:
Me.RadMultiColumnComboBox1.EditorControl.MasterView.TableSearchRow.AutomaticallySelectFirstResult = False
To reproduce: Add a RadMultiColumnCombobox to the form, set the DropDownStyle property to DropDownList and clear the text. You will notice that the height of the control is not bigger than 5 px. Workaround: set MinimumSize Me.RadMultiColumnComboBox1.MinimumSize = New Size(200, 23)
When you copy "Chang" and try to paste it in the editable area, it is not pasted even if the Clipboard data is a valid entry:
Me.RadMultiColumnComboBox1.DisplayMember = "ProductName"
Me.RadMultiColumnComboBox1.ValueMember = "ProductID"
Me.RadMultiColumnComboBox1.DataSource = ProductsBindingSource
Me.RadMultiColumnComboBox1.AutoCompleteMode = AutoCompleteMode.Append
Me.RadMultiColumnComboBox1.MultiColumnComboBoxElement.LimitToList = True
However, the context menu in the text box is available and you can paste even invalid value.
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); } } }
AutoSizeDropDownToBestFit is not working when i have 3 rows in the drop down list. Scroll bars appear with i have 3 rows, and when i only 2 rows it autosize the width of the dropdown.
[Code ]
Dim TransData As DataTable = New DataTable
TransData.Columns.Add("Index")
TransData.Columns.Add("Type")
TransData.Rows.Add("0", "-- Select --")
TransData.Rows.Add("SEA", "Ship by Sea")
TransData.Rows.Add("AIR", "Ship by Air")
TransData.Rows.Add("VOR", "VOR by Air")
TransportRadMultiColumnComboBox.DataSource = TransData
TransportRadMultiColumnComboBox.DisplayMember = "Type"
TransportRadMultiColumnComboBox.ValueMember = "Index"
TransportRadMultiColumnComboBox.Columns(0).IsVisible = False
TransportRadMultiColumnComboBox.Columns(1).HeaderText = "Transport"
TransportRadMultiColumnComboBox.AutoSizeDropDownToBestFit = True
[Works when i have only 2 rows in my DataTable]
When i add 3 rows to my dataTable the AutoSizeDropDownToBestFit does not work.. WHYYYYYYYY??????
This issue is inside the same application as in ticket #667438. There is a MultiColumnComboBox inside the editor form. There are two data sources. One containing the customer's "Rep" field and one for the list of dropdown items (list of Reps). How can the dropdown list be bound to the list of Reps but still display and update the Customer's Rep field? The attached video demonstrates the current behavior of the control.
Dear support,
I have an issue with a multicolumn combobox that won't close upon selection.
The first time (when it is empty) everything goes well, but the second time (in the attached video around the 10th second) it won't close the dropdown if you select the item again.
I suspect it is acting that way because I select the same item.
It is an annoying behavior because now users need to click on the little arrow to close the drop down, which is not intuitive.
I recorded a video that illustrates this issue.
Many thanks again.
Kind regards.
Peter.
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); } }
Workaround:
Workarond: