问题描述:

How can i allow the user to choose the color of the item highlight, when the combobox drop is down and the user has the cursor over the element?(i'm using System.Windows.Controls.ComboBox)

网友答案:

you have to handle the DrawItem of the combobox and create the Graphics accordingly what you want to display.

Following two links will give you Idea how to achieve this Msdn Link

Other Link

网友答案:

The combobox contains, in his resources, the color of the selection. To change it is necessary to remove the resource and insert a new one with the changes you want to make. On the example below '_highlightItem.SelectedBrush' is the new color to be set on the resource.

if (_highlightItem.SelectedBrush != null)
        {
            if (m_oComboBox.Resources.Contains(SystemColors.HighlightBrushKey))
                m_oComboBox.Resources.Remove(SystemColors.HighlightBrushKey);
            m_oComboBox.Resources.Add(SystemColors.HighlightBrushKey, _highlightItem.SelectedBrush);
        }
相关阅读:
Top