Shaan_14
Shaan_14

Reputation: 51

Dynamically Change Background Color of the Page on timer after Page load in windows phone 7

how to dynamically Change Background Color of the Page on timer after Page load in windows phone 7. Suppose there are 4-5 colors that need to be change after particular time.

Upvotes: 0

Views: 266

Answers (1)

Nelson T Joseph
Nelson T Joseph

Reputation: 2763

You can use DispatcherTimer for this operation.

Use the method below in your page and call it from PhoneApplicationPage_Loaded event. Suppose you have to change background color every 5 seconds,

private void ChangeBackgroundColor()
{
    DispatcherTimer dt = new DispatcherTimer();
    dt.Interval = TimeSpan.FromMilliseconds(5000);

    dt.Tick += (s, e) =>
    {
        //Code for change background color 
    };

    dt.Start();
}

This will process every 5 seconds.

Upvotes: 1

Related Questions