User (Old forums)MemberFebruary 18, 2008 at 10:41 amPost count: 23064
Im having a nightmare getting things to work properly with the grid for editing.
Basically I want to call EndEdit whenever a user clicks on another cell, at the moment its only firing when I the user presses Enter. Also Ideally when the grid loses focus however I’ll accept that as a limitation I can workaround if I can get the others basics sorted.
I am beginning to regret the Xceed grid, Ive had to derive from Datarow and datagridcontrol just so I can add my own logic to persist on endedit.
Imported from legacy forums. Posted by MattCheshire (had 3995 views)User (Old forums)MemberFebruary 18, 2008 at 11:06 amPost count: 23064
runtime, modifications made to the content of a cell can be committed when the focus leaves the cell, or discarded when the Escape key is pressed. Programmatically, modifications are committed when the parent row’s EndEdit method is called, and discarded when the CancelEdit method is called. In either case, in order for the modifications to be committed, they must pass the validation process (see Validating Data).
The ONLY way I can get the modification commited (i.e the end edit event to fire on datarow), is when I press Return.???
Imported from legacy forums. Posted by MattCheshire (had 756 views)User (Old forums)MemberFebruary 18, 2008 at 11:20 amPost count: 23064
modifications made to the content of a cell can be committed when the focus leaves the cell
Should that not read when the focus leaves the row? I cant get it to commit when I click on the next cell.
Imported from legacy forums. Posted by MattCheshire (had 657 views)Xceed SupportMemberFebruary 18, 2008 at 5:03 pmPost count: 5658
When designing the DataGrid for WPF, we have decided not to add any “persistence” logic due to the fact that different clients might want to persist modified/added data on to their database/storage at different moments in their application lifetime.
We understand that overriding the DataRow/DataGridControl might look like “overkill” to do such ‘simple’ tasks. We took good notes of the comments about the lack of CLR events to easily connect to the DataGridControl`s actions in order to build application logic around the DataGridControl. We did not include such events from the start because we wanted to make sure not to bring forth in our WPF components some development patterns that might solely belong in WinForms ( when we initially released the DataGrid for WPF, WPF itself was not ‘publicly’ one month old yet and we lacked any frame of reference or design guidelines ).
We are listening to our users and it is in our intentions to correct these shortcomings in future releases.
Concerning the committing of values. At the moment, values are committed to the data item only when the row leaves edition (either by pressing Return, selecting another row, or by explicitly calling Row.EndEdit() or DataGridControl.EndEdit() ). It was a design decision not to end edition when the DataGridControl loses focus ( once again, the need might vary from a user to the other ).
Some people asked for a way to change the “commit” mode of edited values to the data item so that changes are committed back when cells (instead of Rows) leaves edition. Once again, we noted this and are planning to address this issue in an upcoming version.
Finally, I have forwarded your comment about the mistake in the documentation. It should be corrected in the next version of the documentation (thank you for reporting this).
I hope this helped a little bit.
Imported from legacy forums. Posted by Marcus [Xceed] (had 3518 views)User (Old forums)MemberMay 12, 2008 at 10:10 pmPost count: 23064
Our team also found it a bit odd that clicking a button outside of the grid does not fire EndEdit. The result was a crash.
What was the reason the default styles do not, for example, have LostFocus event setup to fire EndEdit?
Imported from legacy forums. Posted by Jack (had 1033 views)Xceed SupportMemberMay 13, 2008 at 8:16 amPost count: 5658
The main reason why there is no default EndEdit() behavior for the LostFocus is because there are too many different scenarios from too many different users.
The recommended usage would be to ensure to call DataGridControl.EndEdit() in the button click handler before proceeding with you code.
Imported from legacy forums. Posted by Marcus [Xceed] (had 1066 views)User (Old forums)MemberMay 19, 2008 at 10:32 pmPost count: 23064
Is there another solution to this? If we have X controls we are going to need to place the end edit code into each X controls, which is …. silly to say the least.
I tried to create a style for the DataRow which fires an event on LostFocus… the problem is the row loses focus when one of its cells enters edit more – which means you can’t edit a cell because it immediately cancels edit!! Catch 22.
Any work arounds to this? Basically when a row loses focus we want to trigger an event which causes edits to be commited and then we can call some of our own logic to validate the item the row is bound to.
Imported from legacy forums. Posted by Jack (had 943 views)User (Old forums)MemberMay 20, 2008 at 7:58 amPost count: 23064
I have had the same problem along with 1 or 2 others here. There is really no event that is fired when you leave the Grid. (Really wish a event was made for thsi scenario)
This is what I do to take care of that event.
(I make no claims that this is the best way to do things but it does seem to work when you leave the Grid. (Unless you click the X to close the program.))
If there is a better way….I am all ears (err eyes).
private void dataGridControl_Site_ID_FocusableChanged(object sender, DependencyPropertyChangedEventArgs e)
private void dataGridControl_Site_ID_GotFocus(object sender, RoutedEventArgs e)
private void dataGridControl_Site_ID_IsKeyboardFocusWithinChanged(object sender, DependencyPropertyChangedEventArgs e)
// this method makes sure your changes are saved when you leave the DataGrid (for some reason the
// data grid doesn’t fire the LostFocus event when a user leaves the DataGrid….very annoying. This event seems
// to work fairly well. Its called a like 6 times or so for some reason when it is fired.
if (dataGridControl_Site_ID.IsFocused == false)
i_static++; // ignore this—using it for testing
private void dataGridControl_Site_ID_LostFocus(object sender, RoutedEventArgs e)
private void dataGridControl_Site_ID_PropertyChanged(object sender, PropertyChangedEventArgs e)
private void dataGridControl_Site_ID_TargetUpdated(object sender, DataTransferEventArgs e)
Imported from legacy forums. Posted by David (had 1013 views)User (Old forums)MemberMay 20, 2008 at 10:31 amPost count: 23064
Please note you will probably have to add additional code if you have childrows that you wish to edit.
Imported from legacy forums. Posted by David (had 2012 views)User (Old forums)MemberJune 11, 2008 at 8:21 amPost count: 23064
What is the intention of commiting the edited values only if the row changed???
I really need to commit the value directly, as soons as the grid shows the new value I want my DataSource to be updated, because I have to recalculate other values of the row…
So… What to do? Any ideas?
Imported from legacy forums. Posted by Christian (had 740 views)Xceed SupportMemberJune 11, 2008 at 8:25 amPost count: 5658
Version 2.1 addresses this issue and many more relating to the edit process.
Imported from legacy forums. Posted by Jenny [Xceed] (had 703 views)User (Old forums)MemberJune 27, 2008 at 8:55 pmPost count: 23064
When is version 2.1 due out?
Imported from legacy forums. Posted by justin (had 627 views)
- You must be logged in to reply to this topic.