Commit edit on lost focus

3 posts, 0 answers
  1. Greg
    Greg avatar
    13 posts
    Member since:
    Jun 2011

    Posted 04 Nov 2011 Link to this post

    I'm using the GridView in a project and I have an issue that I'm hoping has an easy solution. See, my GridView is bound to an ObservableCollection and inserts are enabled. Elsewhere in my UX (on a completely different View, in fact) I have a Save button that will send the contents of the collection off to a web service for processing. The button and GridView have no knowledge of each other in this MVVM app.

    The issue that I'm having, however, is that when a user inserts a new row, but doesn't press ENTER or ESC to cancel or commit then clicks on the Save button, the collection is in a half-baked state. My preferred behavior would be for the GridView to commit the row edit whenever the GridView clicks anywhere outside of the row being edited. Is that possible?
  2. Greg
    Greg avatar
    29 posts
    Member since:
    Oct 2007

    Posted 07 Jul 2015 in reply to Greg Link to this post

    I also am having this problem. In an MVVM scenario with multiple user controls in a layout clicking a button in a user control different from the GridView does not cause the GridView to lose focus and commit the change.

     

    Telerik - answer please!

  3. UI for WPF is Visual Studio 2017 Ready
  4. Greg
    Greg avatar
    29 posts
    Member since:
    Oct 2007

    Posted 07 Jul 2015 in reply to Greg Link to this post

    Answered my own question: Add:

    FocusManager.IsFocusScope="False"

    to all ContentControls on the page/window - this allows the contained controls to "share" focus and thus fires loss-of-focus events on their controls.

Back to Top