WPF 的combobox是获取不到高亮项的,所以必须重写bombobox类,增加获取高亮项属性。点击下载LivePreviewComboBox
从这里下载
使用方法:(需先将LivePreviewComboBox.cs中的namespace改成LivePreviewCombobox)
)
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="clr-namespace:LivePreviewComboBox">
<StackPanel>
<TextBlock Text="Preview Value:" />
<TextBlock Text="{Binding LivePreviewItem, ElementName=liveBox}" />
<l:LivePreviewComboBox x:Name="liveBox"/>
</StackPanel>
</Window>