|
-
Sep 29th, 2010, 05:41 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Filtering WPF viewsource versus winforms bindingsource
Hi all,
As you no doubt can see by the postings i've been making, i'm trying to get my head around the differences between wpf and winforms development. The lights are slowly coming on, but as i encounter each problem, a new speedbump in the road to learning presents itself. Hence my next question.
In my previous winforms app, i had a bindingsource attached to a combobox, and based on a variable i would filter that bindingsource to in turn filter the items in the combobox - example:
Code:
if salesrep = true
CustomerBindingSource.filter = "Territory = '" & territory & "'"
else
CustomerBindingSource.removefilter()
endif
that code would filter the contents of the combobox to only be the currently logged in sales reps customers.
On the WPF side in the window_activated event, i've added the following:
Code:
Dim CustomerViewSource As System.Windows.Data.CollectionViewSource = CType(Me.FindResource("CustomerViewSource"), System.Windows.Data.CollectionViewSource)
If salesrep = True
CustomerViewSource.View.Filter = territory 'show only that reps customers
Else
CustomerViewSource.View.Filter = Nothing 'show all customers
End If
which of course does not work.....so my question is, is a viewsource the route i should take to try and duplicate the behavior of a bindingsource i mentioned above or is there another route, and if so, how do you filter the viewsource if its the right way to go?
as usual, thanks a million.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|