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 learned from one of your samples about how to add a fillter to a PropertyGrid. But, when I tried to remove the filter (view.filter = null), it removed all the properties from the PropertyGrid. Is there any way to fix this problem? Or, is there any examples to remove PropertyGrid filter? |
|
|
That's strange: when I set the Filter to null I see all the properties, which is what I'd expect. However, if you're seeing something different, it's outside our control, because the CollectionView classes and the Filter property are entirely within WPF, we just consume whatever WPF gives us. Fortunately there is an easy workaround, namely to assign a predicate that always returns true: view.Filter = (o => true); |
|
|
I found the Filter only worked statically. If I wanted to dynamically set the Filter when a property value was changed, it didn't work. I need to hide a property, when the value of another property is changed (e.g. change from true to false in a combobox). Do you have any examples to dynamically set Filter when a property value is changed?
|
|
|
WPF filters aren't data-bindable: they don't track the values of properties referenced within the filter. This is a limitation of the WPF architecture. So you will need to write code to re-apply the filter when required. In your case, this could be handled using the PropertyChanged event: ((INotifyPropertyChanged)(grid.SelectedObject)).PropertyChanged += Refilter; private void Refilter(object sender, PropertyChangedEventArgs e) { (Error handling and event unhooking ignored for brevity.) |
|