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
|
ICollectionView view = CollectionViewSource.GetDefaultView(PropertyGrid1.BindingView); works only for root nodes. How to display only some properties if I expand node?
|
|
|
Have a look at the thread at http://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=1181 -- this outlines how to do it and discusses some of the design considerations. |
|
|
Filtering now works for child nodes too after I applyed filtering algorithm recursively in OnInitialized(...) method. I cant find event when node expanded so I could apply filtering code only when node expanded and improve performance
|
|
|
Although the grid doesn't directly expose a "node expanded" event, the grid items are derived from TreeViewItem so you can use the WPF routed event API to capture the ExpandedEvent routed event as it bubbles: grid.AddHandler(TreeViewItem.ExpandedEvent, new RoutedEventHandler(OnNodeExpanded)); In the event handler, e.OriginalSource will be the TreeViewItem, and the TreeViewItem.Header will be the PropertyGridRow: private void OnNodeExpanded(object sender, RoutedEventArgs e) |
|
|
By the way, you can also set up the handler in XAML: <ms:PropertyGrid TreeViewItem.Expanded="OnNodeExpanded" /> |
|
|
After editing value in sub node that node get collapsed. I have to press + to expand node again to continue editing other sub proprties which is extremely annoying. How can I avoid that? |
|
|
We're not seeing that behaviour; could you send us a small project that demonstrates the problem please? (You can attach files to posts via the Options tab.) Thanks! |
|
|
Build 20080703 solved that problem but another problem arise. Changing my sub property cases another sub properties and parent node to change its values too. I added [RefreshProperties(RefreshProperties.Repaint)] to my subproperties but that attriburte has no effect on your pproperty grid. |
|
|
Are you raising PropertyChanged events for the changing properties? |
|
|
My class derived from Animatable, I added INotifyPropertyChanged to all my Animatable classes and overrided protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) if (PropertyChanged == null) PropertyChanged(this, new PropertyChangedEventArgs(e.Property.Name)); Now everything updated properly!!!!!!!!! However if I change some property I would like to hide/show different properties depending on changed property value. Thats mean I need reapply filtering something like microsoft PG does if I add attribute [RefreshProperties(RefreshProperties.All)] What should I do to reapply filtering? |
|
|
I cannot think of an easy way of doing that within the grid. The best I can suggest is that, when you set SelectedObject, you subscribe to that object's PropertyChanged event yourself, and in your event handler reapply the filter if required. However even this may not be viable if SelectedObject is a databound property rather than being set explicitly. I will look into whether we can enhance our support for this scenario but can't promise anything I'm afraid. |
|
|
I am implementing that PropertyChanged scenario but I cant figure out how can i get parent of Mindscape.WpfPropertyGrid.Node. Node contains Children collection but no Parent. Once children node changed I need reapply filter to parent of that node. I am pretty sure you probably just need make some Node member protected/public?
|
|
|
Unfortunately it isn't that simple -- nodes don't actually know their own parents. (Also, I suspect you may not want to apply your filter to Node.Children, but rather to PropertyGridRow.Children.) Are you getting to the node via the TreeViewItem? If so you can get the parent TreeViewItem by calling: TreeViewItem parentTVI = ItemsControl.ItemsControlFromItemContainer(childTVI) as TreeViewItem; parentTVI.Header is then the parent PropertyGridRow, and you can reset the filter on PropertyGridRow.Children. If you don't have a TreeViewItem to navigate from, let me know how you are getting to the Node/PropertyGridRow where you are applying the filter, and I'll see what I can do. |
|