【WPF】ComboBox汇总

一、ComboBox样式

https://blog.csdn.net/lvguoshan/article/details/49178619

 PS:使用过程中发现重写ComboBox样式以后,如果允许手动输入(即不从下拉框中选择),通过Text属性是没办法获取到输入的字符信息的。

 

二、实现下拉框带图文和水印

https://blog.csdn.net/sd7o95o/article/details/116548610

 

三、几种数据绑定的方法

https://blog.csdn.net/youshuai001/article/details/95028357

 

MVVMLight框架下:

1、添加引用System.Windows.Interactivity.dll

xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
或
xmlns:i ="http://schemas.microsoft.com/expression/2010/interactivity"

 

<i:Interaction.Triggers>
     <i:EventTrigger EventName="SelectionChanged">
            <i:InvokeCommandAction Command="{Binding FamilySelectionChangedCommand}"   CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}},Path=DataContext}"/>
     </i:EventTrigger>
</i:Interaction.Triggers>

或:

<i:Interaction.Triggers>
       <i:EventTrigger EventName="DropDownClosed">
               <i:InvokeCommandAction Command="{Binding GetFunctionCommand}" CommandParameter="{Binding ElementName=ComboBoxName,Path=Text}"/>
       </i:EventTrigger>
</i:Interaction.Triggers>

 

posted @ 2021-09-24 09:36  不溯流光  阅读(231)  评论(0编辑  收藏  举报