win8_settingscharm_add_xaml_entry

Adds an option to the "Settings" charm based on an external XAML file for the Windows 8 Native target module.

Syntax:

win8_settingscharm_add_xaml_entry(name, xamlPath, headerRGB, callback, wide);


Argument Description
name The name of the option to add to the charm.
xamlPath Full path to the XAML file to use
headerRGB The header colour of the flyout as a hex string, with the format "#RRGGBB".
callback The script to run if pressed.
wide Set to true for a wide fly-out or false otherwise.


Returns: String


Description

This function is similar to the win8_settingscharm_add_entry only this time you can define your own slide-out menu and options from an external XAML formatted file.

You can then give your new options a name (a string) to show on the fly-out, then you need to add in the path to get to the XAML file (this should be included in the game package as an Included File). You can also define the header colour of the fly-out as hex value #RRGGBB (for example, #ff40a0) and give a script to be called when the setting has been selected. This script must take the following arguments:

The function itself will return the string "OK" if it has successfully added the XAML to the Settings Charm, otherwise it will return a string with the error details. You can find an example of how the XAML should be formatted from the YoYo Games Knowledge Base article HTML and XAML Examples For The Windows 8 Settings Charm.

NOTE: This function is for the Windows 8 Native target module only. For Windows 8 JavaScript support, please see win8_settingscharm_add_html_entry.


Example:

var result = win8_settingscharm_add_xaml_entry("Settings", "xaml2.txt", "#ff20a0", scr_SettingsCallback, false);

The above code will create a new option within the Settings Charm, taken from the given file, and associate it with the script "scr_SettingsCallback".


Back: Windows 8
Next: win8_settingscharm_set_xaml_property
© Copyright YoYo Games Ltd. 2018 All Rights Reserved