Skip to main content

Microsoft Silverlight

Unanswered Question Storyboard continues to work but screen elements do not get loaded when focus is lostRSS Feed

(0)

K2P2
K2P2

Participant

Participant

1028 points

337 Posts

Storyboard continues to work but screen elements do not get loaded when focus is lost

I have two silverlight pages and plan to have many more.

When I start I load Page1 which starts an animation.  The user can then change to Page2 (or PageN) and stay there for an hour or whatever.  When they come back to Page1 they would expect to see that the animation has continued and that it has progressed to an expected state (and we can think of millions of possible reasons why).

The Storyboard on Page1 does in fact continue to run but, because it has lost focus, every new control that gets created and added to a particular Canvas.Children list does not receive a "Loaded" event (or a "LayoutUpdated" event) until we receive focus again.

It may seem logical not to post these events if we do not have focus.  But on the other hand what difference does it make to the "Parent"?  If something gets added why not just tell the object that it got "added" or "loaded" so that it can start whatever animations it may be interested in.  The "Parent" knows it's last Width and Height before it lost focus and the thing that just got added can use that information to position itself wherever it thinks it should be and animate over this area.

If something wants to stop when focus is lost then it can listen for this event and stop.

It would be very difficult to try to "catch up" when they return to Page1.

Skute
Skute

Member

Member

222 points

156 Posts

Re: Storyboard continues to work but screen elements do not get loaded when focus is lost

 This is because objects don't get loaded until absolutely necessary. e.g. if you have an image that is forever covered up by other controls on your page, there is no point downloading it (imagine if the image is 2mb in size but never gets shown).

Flex works in exactly the same way, it delay loads all items on the visual tree. Having said that, Flex does have a property you can set to stop the delay load from happening (and therefore force all controls to load immediately). I don't know if Silverlight has something similar.


K2P2
K2P2

Participant

Participant

1028 points

337 Posts

Re: Storyboard continues to work but screen elements do not get loaded when focus is lost

Thanks for your response.

Every website has it's own requirements.  I could envision a time when I need to download such an image asynchronously in the background even though it might never be viewed.  Just to have it ready.  (I believe that we can do this now.  Although I haven't tried it.)

I, personally, believe that this is a bug.  The storyboard keeps running after it's "host" has lost focus but because the "host" stops getting these events it can't do anything.

Thanks again,
Kevin

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities