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
|
Hello, I'm currently using PropertyGrid.ItemsSource bound to an ObservableDictionary<Class, object> using smart dictionary keys (the key is an object with ToString overridden and the value is the object to be edited). I add objects to the dictionary and I'm grouping them according to the description in the blog post at http://www.mindscape.co.nz/blog/index.php/2008/01/27/sorting-and-grouping-in-the-wpf-property-grid, except I'm grouping them in a category returned by the object instead of by first letter. The grouping works, except at the top there is a Miscellaneous category that seems to wrap everything else in the list. Some of the items in the list do indeed belong to a category that should be called "Miscellaneous" but that just creates a second category with the same name. To illustrate the problem, here's what the grid looks like when it is fully expanded:
Here's the same grid when collapsing the Fog Settings, Ambient Light Color, and bottom Miscellaneous categories:
Finally, here's what happens when I collapse the top Miscellaneous category:
It's like the top category contains all the other categories. Is there any way to get rid of that? Also, while I'm at it, I couldn't find a way to get rid of the X boxes on the right hand side of each line. The values are not read only, but my users shouldn't be able to remove them from the grid. Thanks a bunch! - Mike - |
|
|
Hi Mike, First, regarding the "remove" boxes: set AllowModifyCollections="False" on the property grid and they should go away. Regarding the unwanted mystery category, I am not quite sure exactly how you are setting up the categories but it looks like you already have a GroupDescription in place, possibly by setting the PropertyGrid.Grouping property or possibly from the built-in toolbar, and you are then adding your PropertyReader-based GroupDescription to that. (WPF interprets multiple GroupDescriptions as a hierarchy of groups.) Try clearing BindingView.DefaultView.GroupDescriptions before adding your grouper, e.g.: grid.BindingView.DefaultView.GroupDescriptions.Clear(); or, more simply, set the Grouping property instead of adding the the GroupDescriptions collection: grid.Grouping = new PropertyGroupDescription("Node", new CatConv()); (The article you cite was written before we added the Grouping property, hence the slightly more complicated advice.) If this doesn't help can you post a small repro project (or email it via the Contact form if it would contains sensitive info) and I will investigate further. |
|
|
Ivan, that did it. It's working great! Thanks a bunch! - Mike - |
|