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

Padding from left of image inside drop down list

5 Answers 189 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Kem
Top achievements
Rank 1
Kem asked on 28 Jan 2012, 01:50 AM
Hello

I have a image then text displayed as the selected item of a drop down list. As of now, the image is too close to the left edge of the drop down. I would like to control the distance from the left of all items in my drop down including text and images. How can I accomplish this?

I am using Q2 Build Winform.
Thank You

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 31 Jan 2012, 10:19 AM
Hi Kem,

Thank you for writing.

If I understand correctly, you would like to have padding on the left side of the items in the drop down popup. If this is the case, you can achieve that by subscribing to the VisualItemFormatting event and set the Padding property of the VisualItem:
void radDropDownList1_VisualListItemFormatting(object sender, VisualItemFormattingEventArgs args)
{
    args.VisualItem.Padding = new Padding(5, 0, 0, 0);
}

I hope that this information addresses your question. Should you have any other questions, do not hesitate to contact us.
 
Greetings,
Stefan
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

0
Kem
Top achievements
Rank 1
answered on 31 Jan 2012, 07:35 PM
The code works for items displayed when the drop down is expanded. Instead, I would like to align the item(s) in the drop down when it is not exapnded. I attached a screen shot of my drop down (no expanded). You will see that the image does not have any padding on the left edge of the drop down.

Thank You
0
Stefan
Telerik team
answered on 02 Feb 2012, 12:57 PM
Hi Kem,

Please excuse me for the misunderstanding. You can set the desired padding by setting the Padding property of EditableElement of RadDropDownListElement:
radDropDownList1.DropDownListElement.EditableElement.Padding = new Padding(10, 0, 0, 0);

Let me know if you have any other questions.

Regards,
Stefan
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

0
Kem
Top achievements
Rank 1
answered on 02 Feb 2012, 07:50 PM
That works nicely in code. Is the setting available in a designer? I am using Visual Studio 2010.
0
Stefan
Telerik team
answered on 06 Feb 2012, 12:56 PM
Hi Kem,

Thank you for your reply.

You can introduce this setting at design time by editing the UI Elements of the control. This option is available in the control's Smart Tag. See the attached image for more information.

I hope this helps.

Greetings,
Stefan
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

Tags
DropDownList
Asked by
Kem
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Kem
Top achievements
Rank 1
Share this question
or