locked
CollectionEditor Cancel button does not Cancel the changes done in the items RRS feed

  • Question

  • Hi

    I am using propertyGrid in my Windows Application.In case of collection,property grid displays Collection Editor

    Now When I add/remove anything from collection and click on cancel button,my changes are getting cancelled.

    But if I change value of any item and click on cancel button,changes made are not getting cancelled.

    PLease suggest solution to this problem.

    Wednesday, September 12, 2012 6:36 AM

Answers

  • The changes are committed by the PropertyGrid built into the collection editor, not the collection editor itself.  In other words:  The collection editor is kind enough to provide you with a quick way to set the properties of an individual item, but it is not in control of it.  Yet again, in other words:  The embedded PropertyGrid control does automatic committing of the property values once the editing of the value ends either by pressing the ENTER key or by losing focus, and this behavior is out of the collection editor's grasp.

    Hopefully one of the above explanations serves you well.  Proposed solution:  Sadly I can only think about you providing your own collection editor that doesn't include a PropertyGrid control or one where you control completely what happens, like adding all changes into a designer transaction to be able to fully rollback changes on cancellation.


    Jose R. MCP
    Code Samples

    • Proposed as answer by Mike Feng Thursday, September 13, 2012 8:23 AM
    • Marked as answer by Mike Feng Monday, September 24, 2012 1:59 PM
    Wednesday, September 12, 2012 7:33 AM