Read this article in your language IT | EN | DE | ES
Reference a control that’s is outside your View, or on your MainPage if you’re using NavigationFrame or your “Parent” window.
Assumption: MainPage UserControl page is your starting page and has a NavigationFrame and a View is loaded in a content window.
Method 1: (Assuming “MainPage” is the name of your MainPage or the x:Class it uses, x:Class="<AppName>.MainPage" and the TextBlock named “lblStep1”)
Dim Main As MainPage = CType(<AppName>.App.Current.RootVisual, MainPage)
CType(Main.FindName("lblStep1"), TextBlock).Text = "Hello Test123"
Or Method 2:
CType(CType(<AppName>.App.Current.RootVisual, MainPage).FindName("lblStep1"), TextBlock).Text = "Updated Text"
Reference a Control in a User Control that’s on the same view.
- CType(siTest.FindName("lblStep1"), TextBlock).Text = "Testing"
71492c07-427a-4df6-9644-d441028f8da0|0|.0
Code Snippets, SilverLight
vb.net, silverlight