Scf.Txt Method

Creates a Simple Content Format Txt element.

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



Public Shared Function Txt ( _
    align As ScfAlign, _
    txtWrap As Boolean, _
    color As Nullable(Of Color), _
    ParamArray content As Object() _
) As ScfElement
public static ScfElement Txt (
    ScfAlign align,
    bool txtWrap,
    Nullable<Color> color,
    params Object[] content
static ScfElement^ Txt (
    ScfAlign align, 
    bool txtWrap, 
    Nullable<Color> color, 
    ... array<Object^>^ content
public static ScfElement Txt (
    ScfAlign align, 
    boolean txtWrap, 
    Nullable<Color> color, 
    Object[] content
public static function Txt (
    align : ScfAlign, 
    txtWrap : boolean, 
    color : Nullable<Color>, 
    ... content : Object[]
) : ScfElement


  • align
    Indicates the alignment of the text.
  • txtWrap
    Indicates whether the text is allowed to wrap.
  • color
    Indicates the color of the text.
  • content
    An array of ScfElement objects that make up this content element’s content.

Return Value

Returns an ScfElement object that represents a text element.


This example code shows how the Txt method can be used to add formatted text elements to Dialog, Content, and Menu pages.

private static void SampleTxt()
    // 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 page1Id = 2;
        int page2Id = 3;

        // The menu page. 
        string content =
                Scf.Menu(mainMenuPageId, "Main Menu", ScfSelectAction.Target,
                    // This red, left aligned, wrapping text will be display after the menu title and above the menu items.
                    Scf.Txt(ScfAlign.Left, true, Color.Red, "Some left aligned text."),
                    Scf.Item(page1Id, "Navigate to the content page."),
                    Scf.Item(page2Id, "Nvaigate to the dialog page.")

        // The content page.
        string page1 = Scf.Body(
         Scf.Content(page1Id, "Page 1 Title",
            // Left aligned, wrapping, black text.
            Scf.Txt(ScfAlign.Left, true, Color.Black, "Some left aligned text."),
            // Right aligned, wrapping text that will use the device's default color.
            Scf.Txt(ScfAlign.Right, false, null, "Some right aligned text.")));

        // The dialog page.
        string page2 = Scf.Body(
            Scf.Dialog(page2Id, "Dialog Page Options.",
            // This black, left aligned, wrapping text will display below the dialog page title. 
            Scf.Txt(ScfAlign.Left, true, Color.Black, "Dialog page text."),
            // This button navigates to the content page.
            Scf.Btn(DeviceButton.Enter, "Page 1", page1Id),
            // This button navigates to the main menu.
            Scf.Btn(DeviceButton.Back, "Main Menu.", mainMenuPageId)

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