views:

181

answers:

2

When I resize my aspx page hosting the silverlight app, I lose state on all silverlight controls. How do I maintain state on silverlight controls?

+1  A: 

I'm not sure what precisely you're doing, but under normal circumstances, you should be able to resize your page without doing a page refresh, and hence, without losing state in your Silverlight controls. Are you doing something that's causing a page refresh? If so, yes, that would cause you to lose state. And if that's the case, and you really do need the round-trip back to the server, then you'll need to store your state somewhere else, for instance, in the ASPX page ViewState, or on a web service, or in your local Silverlight storage. But my guess is that you don't actually need the round-trip to the server, i.e., that it's being caused by a side-effect of something else you're doing. I'd start there.

Ken Smith
When I resize the window, it redraws everything on the page and silverlight controls lose their state
Dhawal
In which case I'm not entirely sure either what's happening, or what you mean by "lose state", or for that matter, what you mean by "Silverlight controls". By "Silverlight controls", do you mean the one or more instances of a Silverlight application (.xap file) on an HTML page? Or are you referring to the individual controls within a particular Silverlight application? And what do you mean by "lose state"? What do you see happening when you throw a debugger onto your source?
Ken Smith
A: 

I had this problem too, becuase I'm using a Telerik RadWindow, resizing, reloads the Silverlight app and then you lose the state. If you are using something similar, turn of ReloadOnShow or don't allow resize of the window

Mastro