Scf.Item Method (Generic Nullable, Generic Nullable, Int32, 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 ( _
itemId As Nullable(Of Integer), _
imageId As Nullable(Of Integer), _
contextMenuId As Integer, _
targetId As Integer, _
ParamArray content As Object() _
) As ScfElement
public static ScfElement Item (
Nullable<int> itemId,
Nullable<int> imageId,
int contextMenuId,
int targetId,
params Object[] content
)
public:
static ScfElement^ Item (
Nullable<int> itemId,
Nullable<int> imageId,
int contextMenuId,
int targetId,
... array<Object^>^ content
)
public static ScfElement Item (
Nullable<int> itemId,
Nullable<int> imageId,
int contextMenuId,
int targetId,
Object[] content
)
public static function Item (
itemId : Nullable<int>,
imageId : Nullable<int>,
contextMenuId : int,
targetId : int,
... content : Object[]
) : ScfElement
Parameters
- itemId
Identifies the item’s ID.
- imageId
Identifies the content’s image ID.
- contextMenuId
Identifies the one-based 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
Returns an ScfElement that represents a menu item.
Example
The following example code 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 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