Saving App Settings when Flyout closes

May 6, 2014 at 2:51 PM

I have been looking through the Shoppping example and in particular the implementation of the ChangeDefaults flyout.

I want to expose some of my application wide settings via the Settings charm and a flyout. However, I want to automatically save my settings when the flyout is dismissed. - I presume this is the standard practice.

The shopping example exposes a SAVE button to trigger the Save Command. How could I trigger this command without the Save Button on the screen?

Thanks for your help

May 12, 2014 at 5:06 PM
Hi Graham,

In order to execute the Save handler when the flyout is dismissed, you could configure and override the SettingsFlyout's OnLostFocus() method for handling the OnLostFocus event that the SettingsFlyout throws when it becomes hidden.
Therefore, instead of handling the Save command, the OnLostFocus() method would execute when the Flyout is dismissed and the Flyout's OnLostFocus event is raised. Adding the Save implementation into the OnLostFocus() override method would work as desired.

For more information, you may refer to the followings MSDN sites:

I hope this helped you,

Gabriel Ostrowsky