Click here to Skip to main content
15,905,558 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
OK so here's my problem. I'm new to wpf. using entity framework 4.0. i have 9 collectionviews (I'm currently leaving out 3 of them)

5 of them are bound to the same StaticResource- 'RcViewSource' , however they have different paths leading to different tables within the main collectionview.
I need to be able to sort/filter the main collectionview by 5 of the other views, which are nothing but checkboxes. I know I need to come up with some kind of method to handle the "ischecked" event but I have no clue and it's driving me insane.So far I've come up with:

VB
Private Sub FilterCourses(sender As Object, e As FilterEventArgs)
    Dim c As CoursesTbl = TryCast(e.Item, CoursesTbl)
    If (c Is Nothing) OrElse c.Appetizers = False OrElse c.BreadsRolls = False OrElse c.Desserts = False OrElse c.Entrees = False OrElse c.SaucesGravies = False OrElse c.SideDishes = False OrElse c.SoupSalad = False Then
        e.Accepted = False
    Else
        e.Accepted = True
    End If
End Sub


but I'm not sure if this is right... it only handles 1 of the other views. I still have 4 more. How do i combine the queries? Lambda Expressions?
Please someone help me I've been working on this 1 particular problem for over 3 months now and my brains fried.

Any and all suggestions, posts I could read, tutorial videos would be fantastic....Examples actually using checkboxes as data filters (maybe 2 going to different tables...) would be wonderful also! I would be beyond grateful...

Thanks.
Posted
Updated 13-Aug-12 10:32am
v7
Comments
Richard MacCutchan 23-Jul-12 11:25am    
I have tidied up your code block formattin, you need to tidy up the line breaks.
lewax00 23-Jul-12 11:51am    
In the furture, do not paste additional information in a separate question, instead use the "Improve question" button to add it to the existing one.
ajk825 23-Jul-12 12:25pm    
sorry about that. won't do it again.

1 solution

There are a couple of point here, first you could just Linq to do this job, and Ill guess that would be the simplest thing.

You could also use a CollectionViewSource to filer the data. You could do this with a custom function that implements Predicate of, you could send in multiple arguments to this predicate.

[Edit]
I think you should forget about Beth Massi for a while, and rather go to this lady:
http://bea.stollnitz.com/blog/?p=31[^]
http://bea.stollnitz.com/blog/?p=387[^]
http://bea.stollnitz.com/blog/?p=411[^]

She has some excellent blog post about the issues you are deling with. UInfortunatly she does writ in C# but you should be able to pick up the code :)

Otherwise you could use Linq with predicatebuilder:
http://drc.ideablade.com/xwiki/bin/view/Documentation/predicatebuilder-methods[^]
[/Edit]
 
Share this answer
 
v3
Comments
ajk825 13-Aug-12 17:09pm    
hi kenneth... this is the vb version of the same program i'm having the insert issue with in c# that you had advised me on earlier... i sent ya the link to for beth massi's master/detail example.... i am using a collectionviewsource. it's because their all checkboxes that i'm having this issue... any clues as to where i could find some examples where they use checkboxes as filters for their database? all the examples that i've come across where checkboxes are used have them being used to change the color of texts or some other property of the window... not actual filtering on a database.
Kenneth Haugland 13-Aug-12 17:28pm    
Doing may things at once is not so good if you want a smoopth ride through the tutorial, but I think its a great way to learn :)
ajk825 13-Aug-12 17:55pm    
sweet.... this is a lot so give me a bit to read thru it and see what i can do... i appreciate the suggestions. thanks. i'll let ya know what happens.
Kenneth Haugland 13-Aug-12 19:03pm    
Take the time you'll need :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900