IsEditable:把 ComboBox变成一个文本框;
IsReadOnly:决定文本框是否可以编辑;
只有 IsEditable为 true 时,IsReadOnly 才起作用。
<ComboBox>
<!--Item #1-->
<StackPanel Orientation="Horizontal" Margin="5">
<Image Source="/Pictures/1.jpg"></Image>
<StackPanel Width="200">
<TextBlock Margin="5,0" FontSize="14" FontWeight="Bold" VerticalAlignment="Center">
Curtain Call
</TextBlock>
<TextBlock Margin="5" VerticalAlignment="Center" TextWrapping="Wrap">
Whimsical,with a red curtain background that represents a stage.
</TextBlock>
</StackPanel>
</StackPanel>
<!--Item #2-->
<StackPanel Orientation="Horizontal" Margin="5">
<Image Source="/Pictures/2.jpg" />
<StackPanel Width="200">
<TextBlock Margin="5,0" FontSize="14" FontWeight="Bold" VerticalAlignment="Center">
Fireworks
</TextBlock>
<TextBlock Margin="5" VerticalAlignment="Center" TextWrapping="Wrap">
Sleek,with a black sky containing firworks.When you need to celebrate PowerPoint style,this design is for you!
</TextBlock>
</StackPanel>
</StackPanel>
</ComboBox>
SelectionChanged事件有 AddedItems 包含新的选择 RemovedItems包含老的选择。
Void ComboBox_SelectionChanged(Object sender,SelectionChangedEventArgs e)
{
If(e.AddedItems.Count>0)
{
}
}