This is a migrated thread and some comments may be shown as answers.

Changing alignment the DropDownBox of a RadComboBox

7 Answers 823 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jeremy Murtishaw
Top achievements
Rank 1
Jeremy Murtishaw asked on 22 Jun 2009, 04:46 PM
Hello,

I'm looking to programmatically change the alignment of the dropdown box for my RadComboBox. I'd like the vertical scrollbar to align with the dropdown arrow, and the text to expand further left. Essentially have a top-right alignment instead of a top-left one.

Thanks!
Jeremy

7 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 24 Jun 2009, 04:52 PM
Hi Jeremy,

Thanks for contacting us.

Currently, there is no direct way to set the alignment of the items in the RadComboBox drop down. However, you can use the following code snippet to achieve this programmatically:

foreach (RadListBoxItem item in this.radComboBox1.ComboBoxElement.ListBoxElement.Items)  
{  
    item.Children[2].Alignment = ContentAlignment.TopRight;  

Basically, what I am doing is iterating over all items in the drop down and setting the Alignment of the ImageAndTextLayout that actually positions the text of each item.

We can also consider exposing a property of the RadComboBox which will enable the user to set the alignment of the items within the drop down.

Regarding the alignment of the vertical scroll bar and the drop down arrow, you can use the DropDownMinSize/DropDownMaxSize of the RadComboBox control to explicitly set the minimum width of the drop down popup.

I hope this is helpful.

Do not hesitate to get back to me in case you need further assistance.

Best wishes,
Deyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jeremy Murtishaw
Top achievements
Rank 1
answered on 24 Jun 2009, 08:08 PM
Thank you for your response Deyan, however I believe I may not have been fully clear in my question.

What you have explained how to achieve is alignment of the text for the items within the dropdown listbox. What I am trying to do is change the aligment of the listbox itself. Currently the left side of the listbox is aligned with the left side of the combobox. I would like the right side of the listbox to be aligned with the right side of the combobox, instead. Changes in dropdownwidth would then expand/contract the left hand side of the listbox.

Thanks!
Colin
0
Deyan
Telerik team
answered on 30 Jun 2009, 05:26 PM
Hi Jeremy,

Yes indeed, I have misunderstood your question.

Currently, it is not possible to explicitly define the location of the RadComboBox's Popup (I presume you would like to right-align the RadComboBox' popup form).
 
However, we can consider allowing the user to explicitly determine the alignment of the popup in one of our next releases.

I hope this answers your question.

Do not hesitate to get back to me in case of further questions.

 
Regards,
Deyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
loowool
Top achievements
Rank 2
answered on 24 Nov 2009, 09:23 AM
Dear Telerik,

We're facing the same problem, as we have a multi-column drop down list that is opening in the wrong position when the direction is RTL. We're using the Q3/2009 version, and we need to change the position of the popup drop down list in case of RTL.

How can we solve this problem?

Salah A. Malaeb
TeknoBuild
0
Deyan
Telerik team
answered on 24 Nov 2009, 01:00 PM
Hi Salah,

Thanks for writing. I was not able to reproduce this case.

Could you please prepare a sample WinForms application that manages to reproduce the issue so that we can take a look and see how we can help.

Please note that you will have to open a new support ticket in order to be able to upload your project.

Thanks for your time.

Kind regards,
Deyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Oyvind
Top achievements
Rank 1
answered on 09 Jun 2017, 07:33 PM

Hi,

Noticing this post is 8 years old, was this feature ever implemented?

Thanks!

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Jun 2017, 08:55 AM
Hello Oyvind, 

Thank you for writing back. 

I would like to note that RadComboBox is obsolete. You can use RadDropDownList instead. You can manipulate the location of the popup and thus achieve the desired alignment. Here is a sample code snippet demonstrating how to align the drop down considering the right edge of RadDropDownList:
public RadForm1()
{
    InitializeComponent();
    this.radDropDownList1.PopupOpened += radDropDownList1_PopupOpened;
}
 
private void radDropDownList1_PopupOpened(object sender, EventArgs e)
{
    this.radDropDownList1.DropDownListElement.Popup.Location = new Point(100, 100);
    this.radDropDownList1.DropDownListElement.Popup.LocationChanged += Popup_LocationChanged;
}
 
private void Popup_LocationChanged(object sender, EventArgs e)
{
    DropDownPopupForm form = sender as DropDownPopupForm;
    if (form != null)
    {
        this.radDropDownList1.DropDownListElement.Popup.LocationChanged -= Popup_LocationChanged;
        form.Left += this.radDropDownList1.Width - form.Width;
    }
}

Feel free to post any further questions in the relevant forum: http://www.telerik.com/forums/winforms/dropdownlist-and-listcontrol

Thank you for your understanding 

I hope this information helps. If you have any additional questions, please let me know. 

Regards,
Dess
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Jeremy Murtishaw
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Jeremy Murtishaw
Top achievements
Rank 1
loowool
Top achievements
Rank 2
Oyvind
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or