>In another post, I had asked:
>
>"Once the user clicks on a row in the ListView, how do I get the key value of the customer ID they clicked on so I can call another Linq query to pull up further details or child records, etc?"
>
>Well, I think I found it...
>
>You need to set SelectedValuePath on the ListView to the property of the Customer ID field and then point the SelectionChanged event to a method to, where you can then read the selected Customer ID from the SelectedValue property.
>
>It worsk at least. Maybe there's a better way?
>
>However, how can I receive a reference to the calling ListView in the called SelectionChanged method, so that I do not have to hard-code the "lv2" object reference. That way my method could be used by other ListViews instead of being hard-coded to just the one.
>
>XAML:
>
>
> <ListView Name="lv2" HorizontalContentAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Visible"
> SelectedValuePath="custno" SelectionChanged="CustomerItemSelected">
>
>
>
>Code-Behind:
>
> private void CustomerItemSelected(object sender, SelectionChangedEventArgs e)
> {
> var SelectedCustomerID=lv2.SelectedValue;
>
> ... more code here ...
> }
>
Ya that should work.