Customize color of selected item and item hovering
Hello,
I'm using your example to colorize the items from your documentation:
Appearance in Windows Forms ComboBox control | Syncfusion
cmbProfiles.DropDownListView.DrawItem += new EventHandler<Syncfusion.WinForms.ListView.Events.DrawItemEventArgs>(DropDownListView_DrawItem);
private void DropDownListView_DrawItem(object sender, Syncfusion.WinForms.ListView.Events.DrawItemEventArgs e) { e.Style.BackColor = Color.Red; e.Style.ForeColor = Color.White; }
How to colorize the rest?
Regards
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
VR
Vijayalakshmi Roopkumar
Syncfusion Team
August 2, 2021 12:08 PM UTC
Hi Young
Thank you for contacting Syncfusion Support.
To change the hoverColor of Selecteditem and fore color of DropDownItems, you can use the below property as shown below:
C#
|
//To change tbe backcolor and forecolor ,selectioncolor of SelectedItem in SfComboBox
sfComboBox1.DropDownListView.Style.SelectionStyle.HoverBackColor = Color.Blue;
sfComboBox1.DropDownListView.Style.SelectionStyle.HoverForeColor = Color.White;
sfComboBox1.DropDownListView.Style.SelectionStyle.SelectionBackColor = Color.Yellow; |
For more information about customizing the SfComboBox, refer the following UG documentation:
Sample for your reference : https://www.syncfusion.com/downloads/support/directtrac/general/ze/SfComboBox_DropDownItems-811241647
Kindly try this solution and let us know if it is helpful.
Regards.
Vijayalakshmi VR
Marked as answer
YO
Youki
September 13, 2021 09:29 AM UTC
Hello,
can i add a little bit more padding (top and bottom) in each item.
Regards.
EM
Elakkiya Muthukumarasamy
Syncfusion Team
September 14, 2021 12:35 PM UTC
Hi Young,
Thanks for your update.
We can able to add a little bit more padding (top and bottom) in each item by adjusting the Item Height of SFComboBox DropDownListView. Please refer the below code snippet and screen shot for the same.
Code example:
|
sfComboBox1.DropDownListView.ItemHeight = 30; |
Output:
Please try it with the above solution and let us know if you need any further assistance on this.
Regards,
Elakkiya
SIGN IN To post a reply.