Share via

Scf.Menu Method

Creates a Simple Content Format Menu element.

Namespace: Microsoft.SideShow.SimpleContentFormat
Assembly: Microsoft.SideShow (in microsoft.sideshow.dll)



Public Shared Function Menu ( _
    id As Integer, _
    pageTitle As String, _
    selectAction As ScfSelectAction, _
    ParamArray content As ScfElement() _
) As ScfElement
public static ScfElement Menu (
    int id,
    string pageTitle,
    ScfSelectAction selectAction,
    params ScfElement[] content
static ScfElement^ Menu (
    int id, 
    String^ pageTitle, 
    ScfSelectAction selectAction, 
    ... array<ScfElement^>^ content
public static ScfElement Menu (
    int id, 
    String pageTitle, 
    ScfSelectAction selectAction, 
    ScfElement[] content
public static function Menu (
    id : int, 
    pageTitle : String, 
    selectAction : ScfSelectAction, 
    ... content : ScfElement[]
) : ScfElement


  • id
    Identifies the ID of the menu.
  • pageTitle
    Identifies the title of the content's page.
  • selectAction
    Identifies the action to take when a menu item is selected.
  • content
    An array of ScfElement objects that make up this content element's content.

Return Value

An ScfElement object that represents a menu page.


This example code shows how to create a basic SideShow gadget that sends Simple Content Format XML strings to connected devices by using the static methods of the Scf class. The Body method is used in this example to convert Dialog, Menu, and Content pages into XML strings so they can be sent to connected devices.

private static void SampleScf()
    // Set the gadget's GUID.
    Guid gadgetId = new Guid("{0530B726-F6D5-4a66-900E-3C7673316F3B}");

    // Add the gadget's registry subkey and values.
        false,                           // Register gadget for current user only
        gadgetId,                        // Guid for the registry subkey
        ScfSideShowGadget.ScfEndpointId, // Endpoints registry value
        "Example SideShow gadget",       // FriendlyName registry value
        null,                            // StartCommand registry value
        null,                            // Icon registry value, this gadget will use the generic gadget icon.
        false,                           // OnlineOnly registry value
        GadgetCachePolicies.KeepNewest,  // CachePolicy registry value

    // Construct a Simple Content Format SideShow gadget for the gadget's Guid.
    using (ScfSideShowGadget gadget = new ScfSideShowGadget(gadgetId))
        // Create Simple Content Format Strings and send them to connected SideShow devices.
        // Add Glance content showing date/time of last update
           String.Format("Content updated on {0}{1:D}.", Environment.NewLine, DateTime.Now));

        // Set ids.
        int dialogPageId = 2;
        int mainMenuId = ScfSideShowGadget.HomePageContentId;
        int textPageId = 4;
        int imagePageId = 5;
        int contextMenuId = 6;
        int backgroundImageId = 7;

        // Create the main menu page.
        string content = Scf.Body(
            Scf.Menu(mainMenuId, "Simple Gadget Menu", ScfSelectAction.Target,
                Scf.Item(dialogPageId, "See the dialog page"),
                Scf.Item(textPageId, "See the text Page")));
        // Send the menu page to connected SideShow devices.
        // Create the dialog page.
        content = Scf.Body(
            Scf.Dialog(dialogPageId, "Dialog Page Title",
                Scf.Txt(ScfAlign.Center, true, Color.Violet, "A very long line of wrapping centered violet text."),
                // Set the device buttons.
                Scf.Btn(DeviceButton.Up, "Back to Menu", mainMenuId),
                Scf.Btn(DeviceButton.Right, "Text page", textPageId),
                Scf.Btn(DeviceButton.Down, "Image page", imagePageId),
                Scf.Txt(ScfAlign.Right, false, Color.Yellow, "A long line of non-wrapping right aligned yellow text."),
                Scf.Txt(ScfAlign.Left, false, Color.Red, "A long line of non-wrapping left aligned red text.")));
        // Send the dialog page to connected SideShow devices.

        // Create the text page.
        content = Scf.Body(
            Scf.Content(textPageId, "This is the Text Page",
            Scf.Txt(ScfAlign.Left, true, Color.Blue, "This is some blue text")));
        // Send the text page to connected SideShow devices.

        // Create the image page.
        content = Scf.Body(
            Scf.Content(imagePageId, "Image", contextMenuId, backgroundImageId, ScfBackgroundImageFit.Center,
            Scf.Txt(ScfAlign.Center, true, Color.Red, "Centered Red text"),
            Scf.Txt(ScfAlign.Right, false, Color.Green, "Right Green text")));
        // Send the image page to connected SideShow devices.

        // Add the image ExcelSaga.jpg to the image page.
        Stream imageStream = Assembly.GetEntryAssembly().GetManifestResourceStream("CodeSampleSideShow.ExcelSaga.jpg");
        gadget.AddContent(backgroundImageId, ImageContentTransforms.KeepAspectRatio,

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Development Platforms

Windows Vista Home Premium, Windows Vista Business, Windows Vista Enterprise, Windows Vista Ultimate

Target Platforms

Windows Vista Home Premium, Windows Vista Business, Windows Vista Enterprise, Windows Vista Ultimate

See Also


Scf Class
Scf Members
Microsoft.SideShow.SimpleContentFormat Namespace