Set ComboBox selected item highlight color

前端 未结 2 1914
没有蜡笔的小新
没有蜡笔的小新 2020-12-01 12:50

I need to change the highlight color of a ComboBox\'s selected item in the popup list. I\'ve found several tutorials explaining how to do this, but all of them either use B

相关标签:
2条回答
  • 2020-12-01 13:27

    I have created a template for Combobox here :

    http://wpfstyles.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=31388#DownloadId=78720

    Thanks, Vikas

    0 讨论(0)
  • 2020-12-01 13:31

    Override the SystemColors.HighlightBrushKey (and SystemColors.HighlightTextBrushKey if you want):

    <ComboBox>
        <ComboBox.Resources>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}">Red</SolidColorBrush>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}">Blue</SolidColorBrush>
        </ComboBox.Resources>
        <ComboBoxItem>One</ComboBoxItem>
        <ComboBoxItem>Two</ComboBoxItem>
    </ComboBox>
    
    0 讨论(0)
提交回复
热议问题