Mega Code Archive

 
Categories / C# / WPF
 

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>