Scf.Item Method (Generic , Generic , Boolean, Boolean, Generic , Int32, Object)

Creates a Simple Content Format Item element.

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


Overloads Public Shared Function Item( _
    ByVal itemId As Nullable(Of Integer), _
    ByVal imageId As Nullable(Of Integer), _
    ByVal isEnabled As Boolean, _
    ByVal isDefault As Boolean, _
    ByVal contextMenuId As Nullable(Of Integer), _
    ByVal targetId As Integer, _
    ByVal content As Object _
) As ScfElement
public static ScfElement Item(
    Nullable<int> itemId, 
    Nullable<int> imageId, 
    bool isEnabled, 
    bool isDefault, 
    Nullable<int> contextMenuId, 
    int targetId, 
    object content
static ScfElement^ Item(
    Nullable<int>^ itemId,
    Nullable<int>^ imageId,
    bool isEnabled,
    bool isDefault,
    Nullable<int>^ contextMenuId,
    int targetId,
    Object^ content


  • itemId
    Identifies the item's Id.
  • imageId
    Identifies the content's image Id.
  • isEnabled
    Indicates whether this item is enabled or not.
  • isDefault
    Indicates whether this item should be selected by default.
  • contextMenuId
    Identifies the Id of the page's context menu.
  • 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 can be composed with by calling other Scf methods.


If isEnabled is false then nothing will happen if the user selects the item.


The following example creates a Simple Content Format Menu that contains an item element that is selected by default as well as an item element that is disabled. A disabled item will do nothing if the user selects it.

private static void SampleItem4()
    // 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))
        // Add Glance content.
           String.Format("Some glance content"));

        // Set element ids;
        int mainMenuPageId = 1;
        int icon1Id = 2;
        int icon2Id = 3;
        int icon3Id = 4;
        int page1Id = 5;
        int page2Id = 6;
        int page3Id = 7;

        string content =
                Scf.Menu(mainMenuPageId, "Main Menu", ScfSelectAction.Target,
                    // This is the default item.
                    Scf.Item(null, icon1Id, true, true, null, page1Id, "Displays page 1."),
                    Scf.Item(null, icon2Id, true, false, null, page2Id, "Displays page 2."),
                    // This item is disabled.
                    Scf.Item(null, icon3Id, false, false, null, page3Id, "Displays page 3.")

        // Add the 1st icon.
        string imageLocation = @"C:\Users\Public\SideShowGadget\icon1.jpg";
        gadget.AddContent(icon1Id, ImageContentTransforms.KeepAspectRatio, new Bitmap(imageLocation));

        // Add the 2nd icon.
        imageLocation = @"C:\Users\Public\SideShowGadget\icon2.jpg";
        gadget.AddContent(icon2Id, ImageContentTransforms.KeepAspectRatio, new Bitmap(imageLocation));

        // Add the 3rd icon.
        imageLocation = @"C:\Users\Public\SideShowGadget\icon3.jpg";
        gadget.AddContent(icon3Id, ImageContentTransforms.KeepAspectRatio, new Bitmap(imageLocation));

        // The first page.
        string page1 = Scf.Body(
         Scf.Content(page1Id, "Dialog Page 1 Title",
         Scf.Txt(ScfAlign.Left, true, Color.Black, "Page 1 text.")));

        // The second page.
        string page2 = Scf.Body(
            Scf.Content(page2Id, "Dialog Page 2 Title",
            Scf.Txt(ScfAlign.Left, true, Color.Black, "Page 2 text.")));

        // The third page.
        string page3 = Scf.Body(
            Scf.Content(page3Id, "Dialog Page 3 Title",
            Scf.Txt(ScfAlign.Left, true, Color.Black, "Page 3 text.")));

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, Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

See Also


Scf Class
Scf Members
Microsoft.SideShow.SimpleContentFormat Namespace