Adding Image to ComboBox Item : ComboBox « Windows Presentation Foundation « C# / C Sharp






Adding Image to ComboBox Item

       

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Use ComboBox" Height="300" Width="300">
    <Grid>
        <ComboBox Height="39" HorizontalAlignment="Left" Margin="10,10,0,0" Name="ComboBox1" VerticalAlignment="Top" Width="120" SelectedIndex="0" VerticalContentAlignment="Center">
            <ComboBoxItem>Apple</ComboBoxItem>
            <ComboBoxItem FontFamily="Comic Sans MS" FontSize="18" Foreground="Blue">Banana</ComboBoxItem>
            <ComboBoxItem Name="cbiSmile">
                <StackPanel Orientation="Horizontal">
                    <Image Source="c:\image.bmp" Width="15" Height="15" />
                    <Label Content="Happy!" />
                </StackPanel>
            </ComboBoxItem>
            <ComboBoxItem>Cherry</ComboBoxItem>
        </ComboBox>
    </Grid>
</Window>

   
    
    
    
    
    
    
  








Related examples in the same category

1.ComboBoxItem ContentComboBoxItem Content
2.Content in ComboBox ItemsContent in ComboBox Items
3.Set Different Font for Item for ComboBoxSet Different Font for Item for ComboBox
4.Bounded to ComboBoxBounded to ComboBox
5.Gets the currently selected ComboBoxItem when the user clicks the Button.Gets the currently selected ComboBoxItem when the user clicks the Button.
6.if the user has entered text into the ComboBox instead.if the user has entered text into the ComboBox instead.
7.Handles ComboBox SelectionChanged events.Handles ComboBox SelectionChanged events.
8.Handles ComboBoxItem Selected events.Handles ComboBoxItem Selected events.
9.View and Select Items Using a Combo BoxView and Select Items Using a Combo Box
10.Call the OnPropertyChanged method when its value changedCall the OnPropertyChanged method when its value changed