Freigeben über


How to Create a Windows 8 Settings Pane in XAML

imageThere are five charms in Windows 8: search, share, start, devices, and settings. The reason for the charms is to create a single point of invocation for common tasks. What could be more common and more ubiquitous than settings or options or personalization or preferences? But how do we leverage the setting charm in our Windows 8 apps?

Note: The settings charm is not for desktop apps.

When the user invokes the settings charm by tapping it, the operating system raises an event in your app. Your event handler updates the event arguments with the different setting command links you want to display in the native settings dialog. When the user taps one of those commands, you can handle the event and reveal a flyout.

In XAML, the flyout is actually accomplished with the popup control. Unlike the flyout in JavaScript, however, the XAML popup must be manually implemented for placement, dismissal, animations, et al. As a result, I wrote the SettingsHelper which I demonstrate in the following video. This self-contained class handles all that and makes settings a matter of one or two lines.

Read/watch the whole article here