O'Reilly logo

Microsoft® Silverlight® Edition: Programming Windows® Phone 7 by Charles Petzold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Page State

The SilverlightFlawedTombstoning project is a simple Silverlight program with just one page. The program responds to taps on the screen by changing the background of ContentGrid to a random color, and displaying the total number of taps in its page title. Everything of interest happens in the code-behind file:

Example 6-19. Silverlight Project: SilverlightFlawedTombstoning File: MainPage.xaml.cs (excerpt)

public partial class MainPage : PhoneApplicationPage { Random rand = new Random(); int numTaps = 0; public MainPage() { InitializeComponent(); UpdatePageTitle(numTaps); } protected override void OnManipulationStarted(ManipulationStartedEventArgs args) { ContentPanel.Background = new SolidColorBrush(Color.FromArgb(255, (byte)rand.Next(256), ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required