I've been using WPF for a while now and I've gotten pretty used to many of the (rather daunting to the uninitiated) features: XAML, Binding, Templates, Triggers, etc. But I just can't seem to fully grasp the event system. Something that has gotten on my nerves from the very beginning is that events that are called 'changed' events (ie ListBox.SelectionChanged or TextBox.TextChanged) fire BEFORE the actual property they refer to is changed.
99% of the time I just want to respond to the user input event and see what the new value is. Very rarely do I actually need to respond before the control is updated to cancel the change or save the previous value or whatever.
It makes no sense to me to call these events "changed" events when the change has not yet fully occurred, it is still occurring. It would make a lot more sense at least to me to call these events "changing" events, and then a "changed" event would fire after all was updated.
Yes I know I can use the event args to determine what the new value will be, but this is incredibly annoying and usually requires lots of casting.
Is it too much to ask that when this code fires:
void myTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
DoSomething(myTextBox.Text);
}
that myTextBox.Text have the NEW value of the text property. Am I just crazy? or am I missing something?