Step By Step Creation Of Combo Box Control In Universal Window App


  • Visual Studio 2015

Now, let's get started with the following steps:

Step 1 - Create Windows Universal Project

Open Visual Studio 2015 and click File -> New -> Project Option for New Universal App.


Step 2 - Giving the Project Name

Then, New Project Window will open. There, you can select Installed -> Template -> Visual C# -> Windows -> Universal and select  "Blank App (Universal Windows)".

Type the project name, such as ComboApp and click the OK button.

Project Name

Step 3 - Setting the platform Versions

Here, we choose the Target Version and Minimum Version for our Universal Windows application. Click OK.

platform Versions

Step 4 - Choose Designer Window

Now, go to the Solution Explorer and open the MainPage.xaml for design.

Solution Explorer

Step 5 - Designing the App

In the MainPage.xaml designing page, drag the Combo Box button control from the tool box. Then, go to the Properties window and click Items.

Designing the App

Next, choose ComboBoxitem and click Add.

Combobox item

Now, add the ComboBoxItems that you required.

Combobox item

Next, choose Common -> Content from the properties window and change the item name.


Step 6 - Add the Coding

To add the coding, double click on the Combo box and add the below mentioned source code.


  1. private void combobox_SelectionChanged(object sender, SelectionChangedEventArgs e)   
  2. {  
  3.     if (combobox == nullreturn;  
  4.     var combo = (ComboBox) sender;  
  5.     var item = (ComboBoxItem) combo.SelectedItem;  
  6.     textcombo.Text = "The selected item is " + item.Content.ToString();  
  7. }  
Add the following to the Header file.

  1. using Windows.UI.Xaml.Controls;   
Step 7 - Run the Application

Now, we are ready to run our Project. Click on the Local Machine icon at top ribbon for running the application.





Conclusion - I hope you understood Combo Box button control in Universal Window and how to run it.


Similar Articles