WPF搜索框

<TextBox HorizontalAlignment="Left" Height="24" Margin="10,10,0,0"
Text="{Binding SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" VerticalAlignment="Top" Width="161">
<TextBox.InputBindings>
<!--键盘事件绑定-->
<KeyBinding Command="{Binding Search_Click}" Key="Enter"/>
<!--鼠标事件绑定-->
<MouseBinding Command="{Binding ButtonClick}" MouseAction="LeftDoubleClick"/>
</TextBox.InputBindings>
</TextBox>

posted @ 2021-12-21 16:09  卖雨伞的小男孩  阅读(214)  评论(0编辑  收藏  举报