Loading

MVVM TextBox的键盘事件

MVVM下RichTextBox的键盘回车事件设置为发送,不是回车

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:mv="http://www.galasoft.ch/mvvmlight"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
<controls:BindableRichTextBox x:Name="rtb" Document="{Binding ShowSendMessage,UpdateSourceTrigger=PropertyChanged}" FontSize="20" Grid.Row="1" Background="#FFF9F9F9" Focusable="True" Margin="10,0" BorderThickness="0" AcceptsReturn="False">
    <i:Interaction.Triggers>
        <ei:KeyTrigger FiredOn="KeyUp" Key="Enter">
            <mv:EventToCommand Command="{Binding SendCommand}"/>
        </ei:KeyTrigger>
    </i:Interaction.Triggers>
</controls:BindableRichTextBox>
设置:AcceptsReturn="False" 这个就是不换行

 

posted @ 2016-11-22 20:40  眾尋  阅读(1614)  评论(0编辑  收藏  举报