Scf.Item Method (Generic , Generic , Generic , Int32, Object)
Creates a Simple Content Format Item element.
Namespace: Microsoft.SideShow.SimpleContentFormat
Assembly: Microsoft.SideShow (in microsoft.sideshow.dll)
Syntax
'Declaration
Overloads Public Shared Function Item( _
ByVal itemId As Nullable(Of Integer), _
ByVal imageId As Nullable(Of Integer), _
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,
Nullable<int> contextMenuId,
int targetId,
object content
);
public:
static ScfElement^ Item(
Nullable<int>^ itemId,
Nullable<int>^ imageId,
Nullable<int>^ contextMenuId,
int targetId,
Object^ content
);
Parameters
- itemId
Identifies the item's Id.
- imageId
Identifies the content's image Id.
- 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.
Example
The following example creates a Simple Content Format Menu element with item elements that navigate to dialog pages.
private static void SampleItem3()
{
// 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"));
// Set element ids;
int mainMenuPageId = 1;
int icon1Id = 2;
int icon2Id = 3;
int icon3Id = 4;
int dialogPage1Id = 5;
int dialogPage2Id = 6;
int dialogPage3Id = 7;
string content =
Scf.Body(
Scf.Menu(mainMenuPageId, "Main Menu", ScfSelectAction.Target,
// Each menu item has an icon and links to a dialog page.
Scf.Item(icon1Id, null, dialogPage1Id, "Displays dialog page 1."),
Scf.Item(icon2Id, null, dialogPage2Id, "Displays dialog page 2."),
Scf.Item(icon3Id, null, dialogPage3Id, "Displays dialog page 3.")
)
);
gadget.AddContent(content);
// 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 dialogPage1 = Scf.Body(
Scf.Content(dialogPage1Id, "Dialog Page 1 Title",
Scf.Txt(ScfAlign.Left, true, Color.Black, "Page 1 text.")));
gadget.AddContent(dialogPage1);
// The second page.
string dialogPage2 = Scf.Body(
Scf.Content(dialogPage2Id, "Dialog Page 2 Title",
Scf.Txt(ScfAlign.Left, true, Color.Black, "Page 2 text.")));
gadget.AddContent(dialogPage2);
// The third page.
string dialogPage3 = Scf.Body(
Scf.Content(dialogPage3Id, "Dialog Page 3 Title",
Scf.Txt(ScfAlign.Left, true, Color.Black, "Page 3 text.")));
gadget.AddContent(dialogPage3);
}
}
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, Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000
Target Platforms
See Also
Reference
Scf Class
Scf Members
Microsoft.SideShow.SimpleContentFormat Namespace