Reputation: 892
i am developing one wpf application in mvvm model in prism framework.i created one usercontrol in one module and i used in another module.i successfully import that usercontrol in my module but i can't bind properties to that user control. it act as a single control not different control in user control.so what i will do .following is my code
my usercontrol contain 3 radio button 3 text box 1 data grid
then i reference this usercontrol to my project
xmlns:l="clr-namespace:MagicHospital.Controls;assembly=MagicHospital.Controls"
<l:PatientDetailsUserControl></l:PatientDetailsUserControl>
then how can i bind properties to controls in usercontrol.
Upvotes: 1
Views: 533
Reputation: 31616
You want your compound control to be a gateway to the other controls by creating dependancy properties which are exposed to the outside world. Within the control itself you then have the inner controls bind their properties to the exposed dependancy properties which were created. That way you have the outside world able to bind to specific items on the control, while passing that information on to your target inner controls.
I use Jeff Wilcox's Silverlight dependency snippets to quickly create the properties on both WPF and Silverlight projects.
Upvotes: 1