Controls in a WPF UserControl don`t raise lost focus
I have a MainWindow with 3 main buttons at the top and below a MainUserControl.
In the MainUserControl I have at top 3 UserControls with ButtonBars and at the bottom a DataGrid.
When I enter dat开发者_JAVA百科a in a DataGridCell and I click into another cell a property change is fired in my ViewModel bound to the DataGrid.
When I enter data... and I click on one of the 3 main buttons again a property change is fired because of Lost Focus event.
When I ... and I click on one of the buttons in the ButtonBar in the UserControl no property change is fired because there seem to be no Lost Focus event.
How can I fix that?
FocusManager.IsFocusScope="False" on the UserControl or other elements like Menu solved the problem and my property changes are raised now in the model :)
If you change your binding to to set UpdateSourceTrigger=PropertyChanged then you will not need to rely on the LostFocus to do a property update.
精彩评论