Welcome to the Xceed Community Sign in | Join | Help
Community Search  

EndEdit -

Sort Posts: Previous Next
  •  02-18-2008, 10:41 AM Post no. 10870

    EndEdit -

    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.

  •  02-18-2008, 11:06 AM Post no. 10871 in reply to 10870

    Re: EndEdit -

    [quote]
    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).
    [/quote]

    The ONLY way I can get the modification commited (i.e the end edit event to fire on datarow), is when I press Return.???

  •  02-18-2008, 11:20 AM Post no. 10872 in reply to 10871

    Re: EndEdit -

    [quote]
    modifications made to the content of a cell can be committed when the focus leaves the cell
    [/quote]

    Should that not read when the focus leaves the row? I cant get it to commit when I click on the next cell.
  •  02-18-2008, 5:03 PM Post no. 10873 in reply to 10872

    Re: EndEdit -

    Hi Matt,

    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.

    Marc Laroche
    Software Developer
    Xceed Software Inc.


    I don’t suffer from insanity, I enjoy every minute of it. - Unknown
  •  05-12-2008, 10:10 PM Post no. 12192 in reply to 10873

    Re: EndEdit -

    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?

  •  05-13-2008, 8:16 AM Post no. 12205 in reply to 12192

    Re: EndEdit -

    Hi Jack,

       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.

      

    Marc Laroche
    Software Developer
    Xceed Software Inc.


    I don’t suffer from insanity, I enjoy every minute of it. - Unknown
  •  05-19-2008, 10:32 PM Post no. 12377 in reply to 12205

    Re: EndEdit -

    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. 

  •  05-20-2008, 7:58 AM Post no. 12383 in reply to 12377

    Re: EndEdit -

    Hello,

     

    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)

    {

    Save_Site_ID_Data_To_Database();

    }

     

    private void dataGridControl_Site_ID_GotFocus(object sender, RoutedEventArgs e)

    {

    Save_Site_ID_Data_To_Database();

    }

     

    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

    dataGridControl_Site_ID.EndEdit();

    }

    }

     

     

    private void dataGridControl_Site_ID_LostFocus(object sender, RoutedEventArgs e)

    {

     

    Save_Site_ID_Data_To_Database();

     

    }

     

     

    private void dataGridControl_Site_ID_PropertyChanged(object sender, PropertyChangedEventArgs e)

    {

    Save_Site_ID_Data_To_Database();

    }

     

    private void dataGridControl_Site_ID_TargetUpdated(object sender, DataTransferEventArgs e)

    {

    Save_Site_ID_Data_To_Database();

    }

     

     

  •  05-20-2008, 10:31 AM Post no. 12385 in reply to 12383

    Re: EndEdit -

    Please note you will probably have to add additional code if you have childrows that you wish to edit.

  •  06-11-2008, 8:21 AM Post no. 12856 in reply to 12385

    Re: EndEdit -

    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?

  •  06-11-2008, 8:25 AM Post no. 12857 in reply to 12856

    Re: EndEdit -

    Version 2.1 addresses this issue and many more relating to the edit process.
    Technical Writer - Xceed Software

    Of all the things I've lost, I miss my mind the most. - Mark Twain
  •  06-27-2008, 8:55 PM Post no. 13279 in reply to 12857

    Re: EndEdit -

    When is version 2.1 due out?
  •  06-29-2008, 10:07 AM Post no. 13288 in reply to 13279

    Re: EndEdit -

    They say Summer-2008
    Abdullah Ansari
    Senior Software Engineer
    R Systems International Limited

    Everything is okay in the end. If its not okay, then its not the end.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.