I have a TextBox associated with the ViewModel Text property with the following setting:
Xaml
<TextBox Text="{Binding Text}"/>
FROM#
public class ViewModel : INotifyPropertyChanged { public string Text { get { return m_Text; } set { if (String.Equals(m_Text, value)) { return; } m_Text = value.ToLower(); RaisePropertyChanged("Text"); } }
When I inject some material into a TextBox, it successfully sets the Text property to the ViewModel. The problem is that WPF ignores the event with the changed property that is generated by its own update. This leads to the fact that the user does not see the entered text converted to lowercase.
How can I change this behavior so that the TextBox is updated with lowercase text?
Note. This is just an example that I used to illustrate the issue of ignoring WPF events. I am not interested in converting strings to lowercase or any problems with String.Equals (string, string).
data-binding wpf
Jacob Stanley
source share