Hello,
I'm having some trouble changing the width of the editor for a gridViewComboBoxColumn. I'm using a RadDropDownListEditor. I took a look at this thread: https://www.telerik.com/forums/resize-combobox-27cd57e8088b from several years back but this method still didn't work for me. Below is what I have tried. What am I doing wrong? The dropdownwidth still remains the width of the column no matter what I try.
private void radGridViewDetail_EditorRequired(object sender, EditorRequiredEventArgs e)
{
switch (radGridViewDetail.CurrentColumn.Name)
{
case "CO":
case "CC":
case "Acct":
e.Editor = new RadDropDownListEditor();
break;
}
}
private void radGridViewDetail_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
if (e.ActiveEditor is RadDropDownListEditor)
{
//RadDropDownListEditor editor = (RadDropDownListEditor)e.ActiveEditor;
RadDropDownListEditor editor = this.radGridViewDetail.ActiveEditor as RadDropDownListEditor;
if (editor != null)
{
RadDropDownListEditorElement element = (RadDropDownListEditorElement)editor.EditorElement;
element.DropDownSizingMode = SizingMode.UpDownAndRightBottom; // This does not work
element.PopupOpened += new EventHandler(editorElement_PopupOpened);
//((RadDropDownListEditorElement)((RadDropDownListEditor)this.radGridViewDetail.ActiveEditor).EditorElement).DropDownSizingMode = SizingMode.RightBottom;
//((RadDropDownListEditorElement)((RadDropDownListEditor)this.radGridViewDetail.ActiveEditor).EditorElement).DropDownMinSize = new Size(200, 100);
//((RadDropDownListEditorElement)((RadDropDownListEditor)this.radGridViewDetail.ActiveEditor).EditorElement).Popup.Width = 200;
element.DropDownMinSize = new Size(200, 100);
element.ArrowButton.Visibility = Telerik.WinControls.ElementVisibility.Collapsed; // This works
//element.AutoCompleteMode = AutoCompleteMode.SuggestAppend; // This isn't needed
element.Popup.Width = 200;
element.DropDownWidth = 200;
switch (radGridViewDetail.CurrentColumn.Name)
{
case "CO":
element.AutoCompleteDataSource = coTable;
element.AutoCompleteDisplayMember = "COMPANY_CODE";
element.AutoCompleteValueMember = "COMPANY_CODE";
element.DropDownWidth = 200;
break;
case "CC":
element.AutoCompleteDataSource = ccTable;
element.DisplayMember = "ADDRESS";
element.ValueMember = "COST_CENTER";
element.AutoCompleteDisplayMember = "ADDRESS";
element.AutoCompleteValueMember = "COST_CENTER";
break;
case "Acct":
element.AutoCompleteDataSource = glTable;
element.DisplayMember = "ACCT_DESC";
element.ValueMember = "GLMAJOR";
element.AutoCompleteDisplayMember = "ACCT_DESC";
element.AutoCompleteValueMember = "GLMAJOR";
break;
}
}
}
}
private void editorElement_PopupOpened(object sender, EventArgs e)
{
((RadDropDownListEditorElement)sender).Popup.MinimumSize = new Size(150, 0);
}