Hello Steven Tang,
Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.
I have a quick test on my side as follows, and can reproduce the issue when
I directly close the web browser.
In the .xaml file,
<Page x:Class="WpfBrowserApplication1.Page1"
xmlns="
http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="
http://schemas.microsoft.com/winfx/2006/xaml"
Title="Page1" Unloaded="Page_Unloaded">
<Grid>
</Grid>
</Page>
In the Page1.xaml.cs,
private void Page_Unloaded(object sender, RoutedEventArgs e)
{
MessageBox.Show("Test");
}
But when I press F5 to refresh the XBAP page, the Page's unload event fires
correctly. That is to say, this event will only fires when the embedded wpf
page gets unloaded and the Web Browser remains open. In my opinion, when
we close the web browser directly, the whole XBAP application will shut
down and the resource will be cleaned up automatically. I think it is not
necessary to stop the dispatcher timer there? Could you please clarify what
exactly you want to do in the Unload event handle? So that we can try to
provide a future suggestion on an specific scenario.
And based on my research on the web, I found the following discussion in
the MSDN WPF Forum. We can see that another two possible workarounds will
be Application.Exit and the IProvideCustomContentState. Codes in these
event handler or function are guarantee to be called.
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/e034f5f5-43ca-4b1c-
9b54-d74b727f8e12/
Please let me know if these suggestions fit your scenario.
Best regards,
Ji Zhou (v-jzho@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.