Email: Password:       Forgot Password 
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.

Combo Box In WPF

Viewed:  2704 
Posted On:  23/09/2012 19:29:46 
In this article I am showing how we can use combo Box in WPF. 

In this article I am going to show how we can use combo box in WPF. How we can show selected value in message box. How we can customize our combo box.

Below is my XAML code..

<Window x:Class="ComboBoxInWPF.Window1"
    Title="Window1" Height="300" Width="300">

        <ComboBox Margin="10,10,0,13" Name="ComboBox1" HorizontalAlignment="Left"
         VerticalAlignment="Top" Width="194" Height="30" SelectionChanged="ComboBox1_SelectionChanged">
           <ComboBoxItem Background="LightCoral" Foreground="#00008B" Content="Cricket"
                         FontFamily="Verdana" FontSize="12" FontWeight="Bold" IsSelected="True"></ComboBoxItem>

            <ComboBoxItem Background="LightGray" Foreground="#006400" Content="Football"
                         FontFamily="Georgia" FontSize="14" FontWeight="Bold"></ComboBoxItem>

            <ComboBoxItem Background="LightBlue" Foreground="#FF1493" Content="Tennis"
                         FontFamily="Verdana" FontSize="12" FontWeight="Bold"></ComboBoxItem>

            <ComboBoxItem Background="LightGreen" Foreground="#FF00FF" Content="Hockey"
                         FontFamily="Georgia" FontSize="14" FontWeight="Bold"></ComboBoxItem>

            <ComboBoxItem Background="LightBlue" Foreground="#ADFF2F" Content="Volleyball"
                         FontFamily="Verdana" FontSize="12" FontWeight="Bold"></ComboBoxItem>

            <ComboBoxItem Background="LightSlateGray" Foreground="#FFA07A" Content="Table Tennis"
                         FontFamily="Georgia" FontSize="14" FontWeight="Bold"></ComboBoxItem>


When I run my Application then.


Figure 1.


Figure 2.

By naci  On  03/04/2015 05:49:27
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us