PropertyGrid not updating original object? RRS feed

  • Question

  • Hi

    I'm not really sure exactly how the PropertyGrid is meant to work, but from what I can gather it should automatically update the SelectedObject properties as they are changed in the propertygrid? All the MSDN info I can find covers loading objects into it etc. and controlling property descriptions but doesn't specify whether it handles updating the object properties automatically or not.

    If if should be then my PropertyGrid doesn't appear to be doing this, as breakpoints on the Set{} blocks of properties I'm changing are never reached and the object properties don't appear to change.

    I've tried attaching an event to PropertyValueChanged but that also doesn't ever seem to be called either.

    Am I missing something obvious here?


    edit: I've just tried using the propertygrid with a blank project in both VS2008 (.Net 3.5) and VS2010 (.Net 4.0) by assigning a button and it works, so I can only assume it's a problem with the class I'm trying to assign to my propertygrid? They're all standard types (string, bool and int) so I assume I don't need any convertors? I've also given the properties a CategoryAttribute and DescriptionAttribute

    another edit: I just thought to put a breakpoint on the get{} block on one of the properties it's displaying, and it also doesnt run that, yet its definately getting the value from the class to display it in the propertygrid.
    • Edited by TBA-UK Sunday, August 2, 2009 10:40 AM
    Sunday, August 2, 2009 9:42 AM


  • Problem solved. It appeared VS was failing to build one of the projects because the file was still in use by another process (there was a copy of the file.vshost.exe still running), yet VS didn't think to tell me the build was failing and was just running the old version of the file, mixed in with some new code from other projects (giving the impression all was working except for one or two changes - explains why the breakpoints weren't being reached!)
    • Marked as answer by TBA-UK Sunday, August 2, 2009 10:56 AM
    Sunday, August 2, 2009 10:56 AM