TabControlEx - filtering with CollectionView.Filter

Aug 11, 2010 at 1:19 PM

Hi sacha,

I satarted to implement my own MDI layout instead of Avalon and to use your great tab control extension for caching.

Following scenarion: I have collection of tool "windows" and different places where I can dock them on your tab control (left, rigth, ....), so they have Property DockingOn. On changing that property, they should go to other place.

My question is, what is the best way to do that
    1. will I get problems with caching on tab control?
    2. can I use CollectionView.Filter for that? Binding all tabcontrols on the same collection but with different filters. When it's possible, how can I do that. I'm sitting since 6 hourse on that problem. (Maybe I need refiltering on property changing)
    3. Or should I use the old way and set an observablecollection for every position and manage all that from ViewModel manualy.

Thank you,

Aug 11, 2010 at 1:44 PM

I would use different observablecollection for every position, as Filter is common to single ItemsSource ICollectionView so you will see issues like you describe

Aug 11, 2010 at 6:37 PM
Edited Aug 11, 2010 at 6:38 PM

After 6 houres, your post and 10 minutes rest, I hade the perfect solution. And the best is, it's the same solution as for AvalonDock, BEHAVIOR!

Sometimes I hate WPF and in the next moment I love it! Now I have a Behavior for every ItemsControl, which filters collections for me, so I can bind n of Views to the same collection and let them show, what I want thru MemberPath + Value or Predicat for comlex filtering. All in XAML and Blend.

Thats amasing, what potencial WPF have, the problem is just, you have 1000 ways to solve the problem and you need much experience to choose the right one.

Sacha, do you know how I can upload files here or a good, free place for sharing code stuff. Maybe it's a good feature for Cinch too.

Thanks, dima

Aug 12, 2010 at 12:47 PM

See told you, you would solve it. As for uploading code, I think you can supply possible patches here at codeplex. Or you could use GitHub which is what a lot of people are now using for code sharing, or even googlecode.


As for WPF and the number of ways to do stuff, heck yeah, there are loads and loads of ways to create things, sometimes too many.



Aug 12, 2010 at 12:53 PM

I would be interested to see how you expressed a predicate in XAML though. And yes attached behaviours are very very good way to do stuff, no self respecting WPF programmer should be without them in their toolbelts.

Aug 12, 2010 at 12:57 PM

Sounds like you MDI project, would make a valuable contribution by itself to codeplex, dont you think

Aug 12, 2010 at 2:17 PM
Edited Aug 12, 2010 at 3:00 PM

For predicat filtering I use binding, I dont know any way to do that in XAML. Maybe you know how.

     <local:FilterBehavior ItemsSource="{Binding DocumentManager.Documents}"
                           FilterPredicate="{Binding DocumentManager.PredicatFilter}"/>

and the other way


Edit: something is wrong with RTE on codeplex

Aug 13, 2010 at 7:37 AM
Edited Aug 13, 2010 at 10:48 AM

I'm working on two projects at the moment, commercial one and this one as a platform. So my first priority is to finish the commercial project as fast as possible.

After that I'm really thought about to put my RCP project on codeplex

Edit: very small issue. ViewModelBase.Closeable changing to Closable

Aug 14, 2010 at 10:15 AM
Cool. "very small issue. ViewModelBase.Closeable changing to Closable" Sorry no can do, sick of the sight of all this now, just want to work on something else for a change, doing one more round of enhacements, but after that, no way. Unless it breaks something badly.