开发者

What is the opposite of the Loaded event in Silverlight?

I am writing an app in Silverlight 3 using the Application Navigation template. So each page has a Loaded event, however I don't see a Closing event or an Unloaded event.

Does thi开发者_如何学Pythons concept even exist in SL3? For instance, how do I dispose of resources when this particular page closes and I navigate to another page in my app?


Is this what you need: Page.OnNavigatedFrom Method ?


There is no opposite to the Loaded event. If you hold resources that require disposing then you should implement IDisposable and ensure you dispose of them in your Dispose method. However that isn't a guarantee that the framework will call Dispose.

I'd be inclined to set up my disposable resources in the OnNavigatedTo method and then tear them down in the OnNavigatedFrom method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜