silverlight - Overwrite the style of ComboBoxItem in ComboBox style -
i have silverlight project , want customize appearance of combobox control, add resourcedictionary.xaml file, overwrite default style of combobox, apply new style combobox, , works fine.
<style targettype="combobox" x:key="commoncomboboxstyle"> <setter property = "xxx" value="xxx" /> .... </style> soon realized need customize appearance of comboboxitem, want change background color when item selected/mouseovered, overwritten default style:
<style x:key="filterdowncomboboxitemcontainerstyle" targettype="comboboxitem"> ..... <rectangle x:name="fillcolor" fill="#ff0054a6" ishittestvisible="false" opacity="0" radiusy="0" radiusx="0"/> <rectangle x:name="fillcolor2" fill="#ff0054a6" ishittestvisible="false" opacity="0" radiusy="0" radiusx="0"/> </style> here question, want put filterdowncomboboxitemcontainerstyle in commoncomboboxstyle, need apply commoncomboboxstyle comboboxes want, no need apply filterdowncomboboxitemcontainerstyle separately every comboboxitem, there ways set style of comboboxitem in combobox style?
are there ways set style of comboboxitem in combobox style?
yes, can use combobox.itemcontainerstyle this:
<style targettype="combobox" x:key="commoncomboboxstyle"> <setter property="itemcontainerstyle" value="{staticresource filterdowncomboboxitemcontainerstyle}" /> </style>
Comments
Post a Comment