Link to home
Start Free TrialLog in
Avatar of sbooth1117
sbooth1117Flag for United States of America

asked on

WPF Database CollectionViewSource Question

I'm a WPF newbie so go easy on me.

Generally I've created a window to lookup a person in table.  After closing that window I want to display more information about that selected user.

In one dialog window I have used a DataGrid to select a row representing a person.
After selecting the person, I exit the dialog with the System.Data.DataRow information saved. In the calling dialog I have a CollectionViewSource that contains all of the people.  It seems like I should be able to use the row information that I've saved to move to the same row in the CollectionViewSource, but I can't find a way to do it.  Is there a better way to do this or is there just something that I'm missing?

//C# code saving the person in the find a person window.
selectedItem = dtgPerson.SelectedItem as FAPDataSet.TblPersonRow;

XAML CollectionViewSource binding to table
<CollectionViewSource x:Key="tblPersonViewSource" Source="{Binding Path=TblPerson, Source={StaticResource FAPDataSet}}" />

Thank you in advance for your help.




Avatar of kaylanreilor
kaylanreilor
Flag of Luxembourg image

I suppose that you will have to navigate through your collection, for each item cast the CurrentItem as a FAPDataSet.TblPersonRow object and make a comparison (http://msdn.microsoft.com/en-us/library/ms754244.aspx).
Or you may want to implement a more complex procedure to allow some enhancement later on by using some filter, like allow a multi selection : http://bea.stollnitz.com/blog/?p=31.
ASKER CERTIFIED SOLUTION
Avatar of sbooth1117
sbooth1117
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial