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

Combo Box In WPF

Article:
Viewed:  1547 
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"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">

    
<Grid>
        <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>

        </ComboBox>
    </Grid>
</Window>


When I run my Application then.

Combo1.png

Figure 1.

Combo2.png

Figure 2.

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