private static void OnTextBoxNuevoMensajeChatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChatUserControl controlChat = (ChatUserControl)d; if (e.OldValue != null) { TextBox oldText = (TextBox)e.NewValue; oldText.TextChanged -= new TextChangedEventHandler(controlChat.TextBoxNuevoMensaje_TextChanged); } TextBox newText = (TextBox)e.NewValue; newText.TextChanged += new TextChangedEventHandler(controlChat.TextBoxNuevoMensaje_TextChanged); }
private static void OnBotonEnviarTextoChatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChatUserControl controlChat = (ChatUserControl)d; if (e.OldValue != null) { Button oldButton = (Button)e.NewValue; oldButton.Click -= new RoutedEventHandler(controlChat.BotonEnviarTexto_Click); } Button newButton = (Button)e.NewValue; newButton.Click += new RoutedEventHandler(controlChat.BotonEnviarTexto_Click); }