This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I was unable to find a clear example of how to add custom nodes to a PropertyGrid without code behind. Is this a possibility? We are trying to adhere to the MVVM pattern, so we'd like to avoid code behind where possible. Adding to the complexity, the ViewModel which constitutes the DataContext of the view is generated dynamically, so placing attributes on the properties to group them isn't an option, we need to be able to define grouping nodes in the view. |
|
|
Hello What you are implementing sounds quite complex. For dynamically built models, we recommend you create a class that implements the ICustomTypeDescriptor interface. This lets you provide logic that can change what properties the object has. This is currently the only way you can use binding (MVVM with no code behind) to "Add" custom nodes to the property grid. I'd need more information about your project to show you exactly what to do, but we do provide a simple example of how to implement the ICustomTypeDescriptor interface. Open the Samples solution in Visual Studio, go to the PropertyGridSampleData project and look through the DynamicPerson.cs file. Jason Fauchelle |
|
|
The ICustomTypeDescriptor interface is a good solution, thanks! We were able to implement this interface in our Dynamically generated DataContext for the view, and all the nodes/categories simply work as we desire. |
|
|
Excellent! Great to hear it worked out well. |
|