Click here to Skip to main content
12,354,574 members (62,331 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# WPF DataGrid
I would like to have the ViewModel updated immediately on change of value of a cell. Right now have to wait until focus leaves the record. Is there a XAML attribute I can set to cause immediate update?
Posted 18-Jun-12 11:32am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try to set the UpdateSourceTrigger property of the Binding to PropertyChanged. The default is LostFocus.
<object UpdateSourceTrigger="UpdateSourceTrigger" .../>

Please refer to msdn for further info:[^]
Clifford Nelson 19-Jun-12 12:15pm
Thanks, I forgot about that. Could have been clearer on you answer. In this case the default was not lost focus, but the row looses focus. Give you a 5 anyway, especially since you were the only one able to answer the question. In this case the problem is that you restated what Microsoft has on thier site, and Microsoft has some of the worst documentation of anybody. The article you gave as a link is just so very bad. Probably would not have been accepted on CodeProject.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

The best place to see about this problem is[^]. Here is some of the code from my solution:

     <style x:key="TextBlockRightAlignStyle" xmlns:x="#unknown">
            TargetType="{x:Type TextBlock}">
I included the alignment stuff since somebody may find it useful.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

This works 100%

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 26 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100