There is a class ViewModel which implements INPC. There is a public property TextToSend to which the textbox is bind.
<TextBox Height="120" VerticalAlignment="Top" TextWrapping="Wrap" Margin="5,5,5,5" Text="{Binding TextToSend, Mode=TwoWay}"/> Interface implementation:
class ClientChatModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } Property to which the binding goes:
public string TextToSend { get { return _texttosend; } set { _texttosend = value; OnPropertyChanged("TextToSend"); } } private string _texttosend { get; set; } It does not issue errors, it does not crash, but if any command is executed that is designed to clear the textbox, i.e. clear the _texttosend to which the Text property of the control is bound; the interface does not receive notifications and the text of the control remains, although the property has already changed. What is my mistake?
TextToSend = ""- Andrew NOP