How to get textbox value from user control to user control?

Oct 14, 2013 at 2:29 PM
Greetings, so far this is the best framework for metro style apps.

I would like to ask how to pass data from usercontrol to usercontrol?

usercontrol1 has a text box
usercontrol2 has a text block/label

How can i get the value of the text from the textbox from usercontrol1 by loading usercontrol2 through browsing it using modern menulink?

I am a student using it for my project. Thank you so much.
Oct 14, 2013 at 6:35 PM
For that i use a static property for usercontrol1 then on usercontrol2 i get the value by doing :
label.Content = UserControl1.MyProperty
but i'm not sure that it is the best solution :)
Coordinator
Oct 14, 2013 at 10:16 PM
Use MVVM where the ViewModel maintains the data that is rendered by the View (in your case 2 user controls). If you're new to MVVM, just google introduction to MVVM.
Oct 22, 2013 at 1:32 PM
cYounes wrote:
For that i use a static property for usercontrol1 then on usercontrol2 i get the value by doing :
label.Content = UserControl1.MyProperty
but i'm not sure that it is the best solution :)
could you please help me ? can i have some code?