Hi, My WPF UserControl knowledge is like an hour old. So please forgive me if there are plenty of tutorials or/and answers on SO regarding this question (To be honest I dont think this can be done and will need to re-do code... hence why I thought I ask)
So before creating a UserControl, I had a datagrid that fliters customers based on what text the user typed in a Textbox. Once found, the SelectedItem of that filter DataGrid is then used to bind to a new DataGrid containing a new collection.
So....
Filter DataGrid XAML
SelectedItem="{Binding SelectedCustomer, Mode=TwoWay}"
ItemsSource="{Binding Source={StaticResource cvsCustomers}}"
Once the User selects a Customer in that grid,
a new DataGrid would contain rows of properties based on the SelectedCustomer
ItemsSource="{Binding SelectedCustomer.CustomerOrders}"
All well and good and it works.
However, I am going to use this Filter Customer results functionality a lot in my project, so I have created a UserControl in which the filter DataGrid is working.
I have put this UserControl in a view, so the problem is I need whatever the selectedItem is in the Usercontrol to be bounded to a DataGrid in the view. (Like above)
So I need something like this in the DataGrid in the View.
ItemsSource="{Binding ElementName=myUserControl, Path=SelectedCustomer.CustomerOrders}"
Ok a bit long winded but I hope you understand the problem, and I have given enough knowledge on the subject at hand. If I done something wrong, please tell me and just down vote the question.
Cheers