// Chat Input KeyDown if and only if message is text message private void ChatInput_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) { ChatInput.AppendText(Environment.NewLine); ChatInput.CaretIndex = ChatInput.Text.Length; return; } // Send message here if (String.IsNullOrEmpty(ChatInput.Text)) { return; } SendMessage(new TextMessage() { Message = ChatInput.Text }); // Clear textbox ChatInput.Text = String.Empty; } }