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 |
|