Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Workshop

Quiz

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?

Answers

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();


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial