MVVM下RichTextBox的鍵盤迴車事件設置為發送,不是回車 ...
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" 這個就是不換行