How to Color particular item of combobox

后端 未结 2 1015
小鲜肉
小鲜肉 2021-01-25 20:50

I want to color all \"Unselectable\" Text from combo box. How can i do this? I tried it but i am unable to do this.

My Code is Given Below:



        
2条回答
  •  抹茶落季
    2021-01-25 21:23

    You need to set the foreground property on the ComboBoxItem to the colour you require.

    new ComboBoxItem() { Selectable = false, Text="Unselectable", Value=3, Foreground = Brushes.Red},
    

    MSDN page

提交回复
热议问题