WPF combobox 获取高亮项

来源:互联网 发布:钢结构制图软件 编辑:程序博客网 时间:2024/06/04 21:11

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>


0 0
原创粉丝点击