I'm testing out these controls and have run into a problem... I hope someone can help.
I have a problem with automatically setting the item heights of the dropdown items. In the attached image, you will see that the textbox font size is much larger than the items that appear in the drop down. Since my application is a touch screen application, I need these to be larger so the users can actually interact with the items in the drop down and also the dropdown style must be combobox like so the user's can search the drop downs.
I have tried the following in several different groupings:
RadDropDownList1.ListElement.AutoSizeItems = TrueRadDropDownList1.ListElement.ItemHeight = 34RadDropDownList1.DropDownListElement.ItemHeight = 34RadDropDownList1.DropDownListElement.AutoSize = TrueRadDropDownList1.DropDownListElement.AutoSizeItems = TrueIf there are additional details/settings that would help, please let me know and I will include them.
Cheers
DJ
8 Answers, 1 is accepted
You can control the font of each item. Therefore, please consider the following code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.RadDropDownList1.Items.Add("Item 1") Me.RadDropDownList1.Items.Add("Item 2") Me.RadDropDownList1.Items.Add("Item 3") Me.RadDropDownList1.Items.Add("Item 4") Dim font As New Font("Arial", 14) Me.RadDropDownList1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList Me.RadDropDownList1.Text = "" Me.RadDropDownList1.SelectedIndex = 0 Me.RadDropDownList1.ListElement.AutoSizeItems = True Me.RadDropDownList1.DropDownListElement.Font = font For Each item As RadListDataItem In RadDropDownList1.ListElement.Items item.Font = font NextEnd SubHope that helps
Richard
You can do this via the CellEditorInitialized event.
E.g.
Private font As New Font("Arial", 14)Private Sub RadGridView1_CellEditorInitialized(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles RadGridView1.CellEditorInitialized If TypeOf e.ActiveEditor Is RadDropDownListEditor Then Dim editor As RadDropDownListEditor = CType(e.ActiveEditor, RadDropDownListEditor) Dim element As RadDropDownListEditorElement = CType(editor.EditorElement, RadDropDownListEditorElement) element.ListElement.Font = font element.AutoSizeItems = True End IfEnd SubHope this helps
Richard
any idea pls?
here is my code;
ddlRtt <-RadDropDownList;
List<myCustomObject> ret;
ddlRtt.DataSource = ret;
ddlRtt.DisplayMember = "Desc";
ddlRtt.ValueMember = "Id";
Font f = new System.Drawing.Font("Segoe UI", 20, FontStyle.Bold);
ddlRtt.ListElement.AutoSize = false;
ddlRtt.DropDownListElement.Font = f;
foreach (Telerik.WinControls.UI.RadListDataItem itm in ddlRtt.ListElement.Items)
{
itm.Font = f;
}
I have the same issue where the RadDropDownList box is 200,51 size and is populated by a DataSource. The font for the box is set to Calibri 27pt. But when clicking on the box, the items shown are so small. How do I set up the RadDropDownList box so the items have the same font and size as the text in the box?
Please help!
Thank you for writing.
Your question has already been answered in the support ticket you have opened on the same topic. However, I am posting the answer here as well in order the community to benefit from it.
In order to apply the same font to the editable part of the RadDropDownList, its popup and the auto-complete popup, you need to set the Font property explicitly to each corresponding element:
Dim font As New Font("Calibri", 27, FontStyle.Regular)Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.CustomersTableAdapter.Fill(Me.NwindDataSet.Customers) Me.RadDropDownList1.DataSource = Me.CustomersBindingSource Me.RadDropDownList1.DisplayMember = "ContactName" Me.RadDropDownList1.ValueMember = "CustomerID" Me.RadDropDownList1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown Me.RadDropDownList1.AutoCompleteMode = AutoCompleteMode.Suggest Me.RadDropDownList1.Font = font Me.RadDropDownList1.DropDownListElement.Popup.Font = font Me.RadDropDownList1.AutoSizeItems = True Me.RadDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.Popup.Font = fontEnd SubI hope this information helps. Should you have further questions, I would be glad to help.
Greetings,
Dess
the Telerik team
Thanks to Telerik's support team! They helped me find a solution.
Here is what I did:
Dim font As New Font("Calibri", 27)
Me.RadDropDownList1.DropDownListElement.Popup.Font = font
Me.RadDropDownList1.ListElement.AutoSizeItems = True
Me.RadDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.Popup.Font = font
I hope that helps anyone else running into the same issue.
Thank you for writing back.
I am glad that the suggested solution was helpful for achieving your requirement.
If you have any additional questions, please let me know.
Regards,
Dess
Telerik
See What's Next in App Development. Register for TelerikNEXT.
