Skip to main content

Microsoft Silverlight

Answered Question Refreshing Silverlight canvasRSS Feed

(0)

onok44
onok44

Member

Member

23 points

17 Posts

Refreshing Silverlight canvas

 

Hello all,

I have two images and I’m attempting to make them appear to be blinking by hiding and show their visibility property. I have attempted to do this in Expressions blend but each time I set a keyframe would not recognize that I change the visibility property. My next attempt was the code below:

                while (cnt != 5)

                {

                    if (cnt % 2==0)

                    {

                        keyboard_clear.Visibility = Visibility.Visible;

                        keyboard_enter.Visibility = Visibility.Collapsed;

                        cnt++;

                        Thread.Sleep(1000);                

                    }

                  }

Unfortunately the loop works, but it will not change the visibility of the images as it toggles through the loop. Can anyone help me?

 

johnnystock
johnnystock

Contributor

Contributor

2295 points

362 Posts

Silverlight MVP
Answered Question

Re: Refreshing Silverlight canvas

Unless I'm missing something, it looks to me like you are missing half of your blink.  I would add an else that sets the visibility on those images to the opposite value and still increments cnt and performs the .sleep.

John Stockton
Microsoft Silverlight MVP and RIA Developer at Ascentium
Co-Author of Silverlight 2 in Action
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities