hello please i'm trying to change color of combobox itry with backgroun property
combo.Background= (Brush)new BrushConverter().ConvertFrom("#FEFCD7");
but just border changed
i even try to reach all component inside the combo via VisualTreeHelper and i find that it's composed of Grid then togglebutton and contentPresenter then under the contentpresenter there is textblock i try to change the textblock background but it doesn't work also the grid background but no result
DependencyObject child = VisualTreeHelper.GetChild(combo, 0);
(child as Grid).Background = (Brush)new BrushConverter().ConvertFrom("#FEFCD7");
int x = VisualTreeHelper.GetChildrenCount(child);
List childs = new List();
for (int i = 0; i < x; i++)
{
DependencyObject child2=VisualTreeHelper.GetChild(child, i);
childs.Add(child2);
if (child2.GetType() == typeof(ContentPresenter))
{
DependencyObject child3 = VisualTreeHelper.GetChild(child2, 0 );
int c = VisualTreeHelper.GetChildrenCount(child2);
(child3 as TextBlock).Background = Brushes.Transparent;
(child3 as TextBlock).Background = (Brush)new BrushConverter().ConvertFrom("#FEFCD7");
}
}
please i don't want to change highlightind just the background , i'm using the win8 theme for all my windows
Khan Abrar AhmedPosted Aug 7, 2014, 8:32 AM
http://stackoverflow.com/questions/13212179/changing-the-color-of-combobox-highlighting
http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.drawitem%28v=vs.110%29.aspx
http://www.codeproject.com/Tips/226097/Quick-n-easy-Colour-Combo-Box