Workaround for UpdateSourceTrigger LostFocus on Silverlight Datagrid?

Posted by Dave Lowther on Stack Overflow See other posts from Stack Overflow or by Dave Lowther
Published on 2008-10-31T14:27:00Z Indexed on 2010/04/25 20:33 UTC
Read the original article Hit count: 978

I have a Silverlight 2 application that validates data OnTabSelectionChanged. Immediately I began wishing that UpdateSourceTrigger allowed more than just LostFocus because if you click the tab without tabbing off of a control the LINQ object is not updated before validation.

I worked around the issue for TextBoxes by setting focus to another control and then back OnTextChanged:

Private Sub OnTextChanged(ByVal sender As Object, ByVal e As TextChangedEventArgs)
    txtSetFocus.Focus()
    sender.Focus()
End Sub

Now I am trying to accomplish the same sort of hack within a DataGrid. My DataGrid uses DataTemplates generated at runtime for the CellTemplate and CellEditingTemplate. I tried writing the TextChanged="OnTextChanged" into the TextBox in the DataTemplate, but it is not triggered.

Anyone have any ideas?

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about datagrid