I have one user control in wpf. And I want to use this user control two times in same view.
I am using mvvm approach. Can anybody give me a good suggestion that what approach I should follow.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Um, any reason why you aren’t just using it twice? If you bind to the VM (as the DataContext) with the same properties, it will “just work,” no differently than binding two TextBlocks (or other “regular” control) to the same property in the VM.
Here I use the same control in the same window, but it could just as easily be used in the same UserControl, DataTemplate, etc. – whatever you are defining as a “view”.
XAML
Code Behind