tag:blogger.com,1999:blog-3152396868801847155.post7775230083834259008..comments2022-03-27T09:53:25.685+02:00Comments on Codefluff: Committing bound cell changes immediately in WPF DatagridChristophhttp://www.blogger.com/profile/01477573477583414994noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-3152396868801847155.post-66919950223096685782017-08-02T08:14:45.191+02:002017-08-02T08:14:45.191+02:00This is a easy way:
private void MenuItem_Preview...This is a easy way:<br /><br />private void MenuItem_PreviewMouseMove(object sender, MouseEventArgs e)<br /> {<br /> Grid.CommitEdit();<br /> }Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-26440244310013333082014-03-14T05:51:12.128+01:002014-03-14T05:51:12.128+01:00Thanks a lot dude cheersThanks a lot dude cheersAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-88443920531168737762014-01-15T14:05:40.951+01:002014-01-15T14:05:40.951+01:00Thanks tou saved me ! I upgraded from wpf Toolkit ...Thanks tou saved me ! I upgraded from wpf Toolkit DataGrid to 4.X DataGrid and didn't understand why propertychanged was not issued on selecting a cell on same row ;-)<br /><br />Godd job Bro'!Marcoexonoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-27454029860693582732013-09-27T17:22:54.144+02:002013-09-27T17:22:54.144+02:00Thanks, it resolved my problem.Thanks, it resolved my problem.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-71444008918265112122013-05-15T16:08:21.969+02:002013-05-15T16:08:21.969+02:00What if focus is still exist in the respective cel...What if focus is still exist in the respective cell which is a text box?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-42616511634852944542013-04-30T16:34:45.612+02:002013-04-30T16:34:45.612+02:00Thank you for your article. I'm using this han...Thank you for your article. I'm using this handler with the CellEditEnding="HandleMainDataGridCellEditEnding" of my WPF DataGrid.<br />I'm also setting TAB and SHIFT+TAB functionality to my grid, in the GridView_PreviewKeyDown.<br />When pressing the TAB, I'm moving focus to the NEXT cell, and when pressing the SHIFT+TAB I'm moving focus to the PREVIOUS cell.<br />I have an event handler with each grid-cell, where each cell is of type TextBox. This handler is called TextBox_PreviewLostFocus.<br /><br />When using TAB, the functionality is as expected (i.e. HandleMainDataGridCellEditEnding is executed after TextBox_PreviewLostFocus).<br />However when pressing SHIFT+TAB, "HandleMainDataGridCellEditEnding" is not being executed after TextBox_PreviewLostFocus.<br /><br />Does your handler need to be called from any other specific place, since on SHIFT+TAB, CellEditEnding is not called. <br /><br />Thanks.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-53436107941031658852012-11-21T07:56:26.487+01:002012-11-21T07:56:26.487+01:00hi,
after celleditendingevent, i want to set the ...hi,<br /><br />after celleditendingevent, i want to set the focus on the next cell of the selected row, do u have suggestion for this problem.Giri Prasadhttps://www.blogger.com/profile/06270906900165886881noreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-44887261801720363842012-09-14T13:18:48.914+02:002012-09-14T13:18:48.914+02:00Need to call "Keyboard.ClearFocus()" at ...Need to call "Keyboard.ClearFocus()" at the end. Otherwise very gooddashingsiddshttps://www.blogger.com/profile/01505530253937927886noreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-7176186002134518522012-03-21T12:33:07.631+01:002012-03-21T12:33:07.631+01:00GREAT!!!
THXGREAT!!!<br />THXAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-36419193160697863312012-03-05T13:40:09.882+01:002012-03-05T13:40:09.882+01:00Hi, you write [...] if the bound object does imple...Hi, you write <i>[...] if the bound object does implement IEditableObject in which case the DataGrid uses the object's edit capabilities [...]</i>.<br />I've collection of objects implementing IEditableObject, but DataGrid still using "per-row edit" and I don't see changes immediately. What I have to do to use IEditableObject capabilities? Where (in the code) DataGrid (or CollectionView) check and decide to use intermediary object instead of IEditableObject?Carnifexhttps://www.blogger.com/profile/03038724120742225163noreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-19213996012775685262011-12-23T16:52:34.197+01:002011-12-23T16:52:34.197+01:00This is beautiful. Using this allowed me to easil...This is beautiful. Using this allowed me to easily get a reference to actual datarows and make additional updates to the values, without having to do some really messy "ItemContainerGenerator.ContainerFromIndex(e.Row.GetIndex)" stuff. Thank you!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-48083766995899210442011-10-13T16:35:47.321+02:002011-10-13T16:35:47.321+02:00perfect! thanksperfect! thanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-36357036213012441632010-08-27T13:51:32.285+02:002010-08-27T13:51:32.285+02:00Thanks a whole bunch ! I been struggling with th...Thanks a whole bunch ! I been struggling with the issue for the past few days. Your solution together with Christopher's is a great help to me.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-87016317001162977942010-07-14T13:10:14.222+02:002010-07-14T13:10:14.222+02:00You also should only commit when e.EditAction is D...You also should only commit when e.EditAction is DataGridEditAction.Commit, otherwise pressing Cancel will not undo the current change.Christopher Theunissennoreply@blogger.comtag:blogger.com,1999:blog-3152396868801847155.post-45961825336259765322010-05-30T19:00:11.001+02:002010-05-30T19:00:11.001+02:00Thanks very much for posting. I'm using the co...Thanks very much for posting. I'm using the code in a Window to display an editable matrix. The user edits any cells before closing. Therefore you code is also called from Window closing.<br /><br /> Private isManualEditCommit As Boolean<br /><br /> Private Sub MainWindow_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.Closing<br /> CommitEdit()<br /> MsgBox(dt.Rows(0)("Column1") & " " & dt.Rows(0)("Column2"))<br /> End Sub<br /><br /> Private Sub DataGrid1_CellEditEnding(ByVal sender As Object, ByVal e As System.Windows.Controls.DataGridCellEditEndingEventArgs) Handles DataGrid1.CellEditEnding<br /> CommitEdit()<br /> End Sub<br /><br /> Sub CommitEdit()<br /> If Not isManualEditCommit Then<br /> isManualEditCommit = True<br /> DataGrid1.CommitEdit(DataGridEditingUnit.Row, True)<br /> isManualEditCommit = False<br /> End If<br /> End SubAnonymousnoreply@blogger.com