Closed ashleydavis closed 13 years ago
Hi Ash, PropertyGrid UI sits on the top of "Properties"/"Categories" collection properties. You can add new properties from code behind even they do not belong to the original object. Does that make sense? Thanks, Denis
That sound cool. Is it possible to data-bind to Properties and Categories?
Thanks Ash
Absolutely. This is what "Categorized" and "Tabbed" layouts actually do. You can write your own layout that binds to Properties and Categories and that displays whatever you need to.
Thanks, I'll figure it out. You should provide a sample that shows how to use property grid in this way.
I wasn't able to data-bind to Properties because it has a private set accessor. Presumably the same for Categories. Now it would be great if this control had both Properties and PropertiesSource in the same way that ItemsControl has Items and ItemsSource.
Ash
Actually unfortunately I don't think I can use WPFPropertyGrid for what I am doing. Event though PropertyItem objects can be added from code-behind the control still appears to only be usable with properties from normal C# classes.
My 'properties collection' is simply a collection of name/value pairs that I want to display in the property grid, but it doesn't appear to support this.
Please correct me if I am wrong. Thanks Ash
Hi Ash, Everything depends on the complexity of your scenario. If you need visualizing a dictionary with couple of editors and don't need layouting, categorizing and many other things every PropertyGrid control provides then I think the best idea would be considering re-templating some existing WPF ItemsControl. Silverlight has a great DataForm control that helps accomplishing such scenarios but WPF does not have it by default. You could take a look at this project to see whether it suits your needs and does not provide unnecessary complexity: http://wpfdataform.codeplex.com/
Denis
Ideally I'd prefer to use a simple control. But that's not the problem here, your property grid simply doesn't appear to support data-driven properties.
Thanks for your time. Ash
Hi,
My business objects, as you call them, are not represented by POCOs. Each one is represented by a data-driven collection of properties.
Does the property grid allow a collection of properties to be added?
Cheers Ash