2

Closed

Feature request: PropertyGrid - Parent Property Display does not update on Sub-Property Value Change

description

Let's say I have the following object:
 
public class MyCustomObject
{
public string MyString { get; set; }
public int MyInt { get; set; }
public bool MyBool { get; set; }
 
public override string ToString()
{
    return string.Format("{0} - {1} - {2}", MyInt, MyString, MyBool);
}
}
 
And then we have this class (referenceing the 'MyCustomObject' in a property)
 
public class MyViewModel
{
private MyCustomObject _myCustomObjectInstance;

[ExpandableObject]
public MyCustomObject MyCustomObjectInstance 
{ 
    get { return _myCustomObjectInstance; }
    set { _myCustomObjectInstance = value; }
}    
 
public MyViewModel()
{
    MyCustomObjectInstance = new MyCustomObject() { MyInt = 4, MyString = "Four", MyBool = true };
}
}
 
I then set an instance of MyViewModel to be the SelectedObject of the PropertyGrid. The MyObjectInstance property shows up fine, and I am able to expand it to see the sub-properties. You'll also notice that the MyObjectInstance property is displayed using the ToString() representation, which is created via the 3 properties in the object itself. What I'm expecting is that when those sub-properties change, the display of the MyObjectInstance property should change as well... I believe this used to be taken care of via the 'NotifyParentProperty' attribute within the original WinForms PropertyGrid, but it doesn't appear to work in this case. Am I wrong (from a user's perspective) to expect this functionality?
 
I have attached an image to show you the behavior... Do you think this is a bug? Is it a feature request? It seems like it would be a trivial fix, but we all know where that line of thinking can take you ;-).
 
This is a great project. Your work is very much appreciated.
 
Thank you

file attachments

Closed Sep 19, 2012 at 9:11 PM by emartin

comments

brianlagunas wrote Jan 7, 2012 at 4:16 AM

This is a feature request. I will look into this and see what I can do.

emartin wrote Sep 14, 2012 at 7:04 PM

That could help to find possible fixes
http://stackoverflow.com/questions/2296165/wpf-binding-notify-change-to-tostring-value

And I like that Multibinding approach where you don't need to create a custom property for the need:

http://elegantcode.com/2009/04/07/wpf-stringformat-in-xaml-with-the-stringformat-attribute/

wrote Sep 19, 2012 at 9:11 PM

not implemented