Apply ComboBox Selected Color To The Form’s Background Color In WPF1 min read

Introduction:
           This article is used for binding system color properties in a combo box, even the same scenario will work with any other control. Combo box selected color applies to the form’s background color.

Background

Open visual studio 2015 and create a new project from WPF.

W1

Project opened like as below the figures.

Normally WPF design xaml code .

W2

Now I am replacing from grid to stackpanel and placing the combo box inside the stack panel.

W3

Write the event in title tag Loaded.Ex: Window_Loaded

 

Binding Colors in Combo box ItemsSource.

W4Using the code

Write a code for combo box selected change event. and assign color on background form color

W5

Run visual studio.

W6

Now colors are loaded in combo box. If you selected any color in this combo box, it should apply to the form background.W7

Author Profile

Thiruppathi Rengasamy
I 'm a .Net Developer & Blogger. And also I'm working as senior software engineer in Microsoft Technologies for 5+ Years.I would like to spend my precious time in writing articles, research in .Net technologies and to learn new technologies.

Hits: 56