Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
1. How can you detect the theme being used on the phone?
2. How should you save the value of a TextBox control during a tombstone event so it can be restored later?
3. How can you retrieve the application version number?
1. The following code can be used to detect the current phone theme:
return (Visibility)Application.Current.Resources ["PhoneDarkThemeVisibility"] == Visibility.Visible) ? "dark" : "light";
2. The following code can be used to save the text value of a TextBox control named textBox1:
PhoneApplicationService.Current.State["textBox1"] = textBox1.Text;
3. The following code can be used to retrieve the application version number:
Assembly.GetExecutingAssembly().GetName().Version.ToString();