Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styling WPF/Silverlight ComboBox

I'm trying to figure out how to change the popup part of the ComboBox control. I'm not very familiar with custom styling and templating.

I have a defined popup as in:

<Popup 
      Name="Popup"
      Placement="Bottom"
      IsOpen="{TemplateBinding IsDropDownOpen}"
      .....>
    .... some content
</Popup>

I know that ComboBox control has a named popup called "PART_Popup". How do I replace default implementation with my own?

Thanks


1 Answers

You could use the loaded event and search for that part in code behind to replace it which might not work since not all PART elements are mandatory. Normally you would copy the exisiting template and change the relevant parts, you can set the template via the ComboBox.Template property.

If you only want to style, rather than significatly change anyhting you can use an implicit style for the popup as well.

Default Templates can be found on MSDN:

WPF ("Default WPF Themes." Link)
Silverlight (Various sub-pages)

like image 194
H.B. Avatar answered May 02 '26 16:05

H.B.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!