Scf.Item Method (Int32, Object)

Creates a Simple Content Format Item element.

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

Usage

Syntax

'Declaration
Public Shared Function Item ( _
    targetId As Integer, _
    content As Object _
) As ScfElement
public static ScfElement Item (
    int targetId,
    Object content
)
public:
static ScfElement^ Item (
    int targetId, 
    Object^ content
)
public static ScfElement Item (
    int targetId, 
    Object content
)
public static function Item (
    targetId : int, 
    content : Object
) : ScfElement

Parameters

  • targetId
    Identifies the ID of the content that the device should navigate to.
  • content
    An ScfElement object that makes up this Item element's content.

Return Value

An ScfElement object that represents a menu item.

Example

The following example code creates a Simple Content Format Menu element that navigates to three Item elements.

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

    // Add the gadget's registry subkey and values.
    GadgetRegistration.Register(
        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
        null);

    // Construct a Simple Content Format SideShow gadget for the gadget's Guid.
    using (ScfSideShowGadget gadget = new ScfSideShowGadget(gadgetId))
    {
        // Add Glance content.
        gadget.AddGlanceContent(
           String.Format("Some glance content"));

        int mainMenuPageId = 1;
        int firstPageId = 2;
        int secondPageId = 3;
        int thirdPageId = 4;
        
        // Create the main menu with 3 menu items.
        string content =
            Scf.Body(
                Scf.Menu(mainMenuPageId, "Main Menu", ScfSelectAction.Target,
                    Scf.Item(firstPageId, "First Page"),
                    Scf.Item(secondPageId, "Second Page"),
                    Scf.Item(thirdPageId, "Third Page")
                    )
                );
        // Send the content to connected SideShow devices.
        gadget.AddContent(content);
    }
}

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.

Platforms

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

Reference

Scf Class
Scf Members
Microsoft.SideShow.SimpleContentFormat Namespace