I am playing around with testing Silverlight application. One of the tutorials on the web uses MainPage object, where MainPage is the main Silverlight class. Eg:
MainPage mp = new MainPage();
It’s all good, but MainPage XAML has some controls that I can access at MainPage class code, eg, I can use
txtPhotoUrl.Text;
to access
The problem is after creating an object of class MainPage I cannot access the XAML controls – I cannot see them in the list of MainPage object properties. Is this by design or am I missing something?
By default MainPage controls has internal access modifier.So, you can access MainPage controls from the same assembly. For instance,
You can change access modifier using x:FieldModifier=”[private/internal/public]” attribute in XAML for some control. For instance,