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
|
Hey, I am experience an issue with trying to add to the GroupDescriptions, The problem is when I initail load the property grid and call my function SetupCategories(), which contains the following code PropertyGrid.BindingView.DefaultView.GroupDescriptions.Clear(); List<string> groups = new List<string>();foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(PropertyGrid.SelectedObject)){ if (!groups.Contains(property.Category)){ if (property.IsBrowsable){ groups.Add(property.Category); } } } groups.Sort(); PropertyGroupDescription grouper = new PropertyGroupDescription("Node", new NodeToCategoryConverter());foreach (string group in groups)grouper.GroupNames.Add(group); PropertyGrid.BindingView.DefaultView.GroupDescriptions.Add(grouper);
All works great for the initial load but, after calling it again once a new object has been selected, NOTE using the same page I am not destroying and creating the page when the selected Object has changed. I get the following exception in my output window System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.TreeView', AncestorLevel='1''. BindingExpression:Path=ActualWidth; DataItem=null; target element is 'TreeListViewItem' (Name=''); target property is 'MaxWidth' (type 'Double').
I have an event called SelectedObject changed, when this event fires I want to re-create the GroupDescriptiors. I noted that if I re-create the page everytime the selectedObject changes this error doesnt occur, but I feel that this shouldnt be neccessay, I hope my explanation is thorough enough.
Thanks, Justin |
|
|
Hello Justin, As far as I can tell this is just a trace message (though the message I see is slightly different) and does not have any impact on the behaviour or appearance of the grid. Are you seeing a problem with the behaviour or appearance? If so, can you describe the problem you are seeing? Thanks! |
|
|
I'm not seeing a problem with the behaviour nor appearance just response time is much slower, what would you suggest I do to get around this problem? Thanks |
|
|
Hmm, I've been trying to reproduce this and while I am seeing binding error trace messages I am not seeing a perceptible slowdown. However, my binding trace error messages are different from yours -- yours sounds like it is measurement related, and if that is inducing an additional measure pass then that could be the source of the perf issue. So perhaps there is some difference between your project and mine that is causing this difference. Could you post or email a project that reproduces the problem, so I can try to track this down for you? Thanks! Also, which version of .NET are you on -- 3.5 or 3.5 SP1? |
|
|
Im using 3.5 sp1 if that helps, im hoping I can give you a test project with the scenario in the next couple of days sorry about the delay, what binding error message are you getting. Thanks |
|
|
Same .NET version as I'm using so that rules that out as a source of difference. The error message I get complains about the SelectedGridItem property binding, whereas yours referred to the MaxWidth property. I may be reading too much into this, but it makes me think there's some difference between your project and my test, and I need to isolate this difference. I'll look forward to getting the repro case -- thanks! |
|