WPF TextBox lost focus as an attached property

I have a grid with many text fields, and I want to call a method NotifyPropertyChanged()to update some other controls every time one of these text fields changes value = lost focus ( I don't want > to use PropertyChangedhow UpdateSourceTrigger)

This is what I can do:

<Grid TextBoxBase.TextChanged="My_TextChanged"  >
...
</Grid>

I need something like:

TextBoxBase.OnLostFocus
+3
source share
2 answers

Use Lost Focus Event

TextBox.LostFocus="OnTextBoxLostFocus"

Filter by text fields;)

private void OnTextBoxLostFocus(object sender, RoutedEventArgs e)
{
    if(!(e.OriginalSource is TextBox))
        return;

    //Do stuff
}

, . , , LostFocus .

!

0

TextBoxBase.LostFocus, , , .

: http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.textboxbase_events.aspx - UIElement - UIElement.LostFocus, .

0

Source: https://habr.com/ru/post/1751381/


All Articles