void binding_Executed(object sender, ExecutedRoutedEventArgs e) { try { if (!String.IsNullOrWhiteSpace(tbMessage.Text)) { if ((Tabs.SelectedItem as ClosableTab).Tag is UserInfo) { client.SendMessageTo((Tabs.SelectedItem as ClosableTab).Tag as UserInfo, tbMessage.Text); } else if ((Tabs.SelectedItem as ClosableTab).Title.ToString() == "Lobby") { client.SendMessage(tbMessage.Text); } } tbMessage.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message); } }