O'Reilly logo

Programming Windows Store Apps with C# by Iris Classon, Matthew Baxter-Reynolds

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Settings

The last charm-based feature that we’re going to look at is the settings charm, which allows you to define a set of commands that are presented along with one or two standard options within each app. Although originally defined within the Windows 8 experience vision as a common way to provide access for settings, a de facto standard has emerged whereby apps use it to provide access to their Help options. There is also a store requirement to provide easy access to a “privacy policy,” and this should be done through the settings charm.

In this chapter, we’re going to look at the standard options first and then add an option to jump out to the web browser to display the privacy policy. We’ll build a flyout that can be used to host normal settings. (A flyout is a panel that winds in from the right side of the screen, similar to a pop up.) Within this flyout, we’ll look at taking some marked-up text and rendering it in a “prettified” fashion. This will show us how we can render help content within the app if we aren’t using HTML, and also show how we can render more richly formatted text within the app, where it’s often impractical to host IE and render HTML.

Adding Options

Let’s now look at the basics of how to add options. As you may have guessed, this is an issue of asking WinRT to return a handler, whereupon we bind to events and feed back the information. In this case, we use WinRT’s SettingsPane class and respond to the CommandsRequested event. When we do this, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required