void SendMessageCommand_CanExecuteChanged(object sender, EventArgs e) { var sendMessageButton = ApplicationBar.Buttons[0] as IApplicationBarMenuItem; if (sendMessageButton != null && SendMessageCommand != null) { sendMessageButton.IsEnabled = SendMessageCommand.CanExecute(null); } }
private void PreviewKeyDown(KeyEventArgs e) { if (e.Key == Key.Enter && SendMessageCommand.CanExecute(null)) { SendMessageCommand.Execute(null); LocalChatState = ChatStateEvent.Paused; } else if (e.Key == Key.Delete || e.Key == Key.Back) { LocalChatState = ChatStateEvent.Deleting; } else { LocalChatState = ChatStateEvent.Composing; } }