Graphic Element

Displays an image.

Syntax

<Graphic
    AcquiringImage="Image object"
    Alpha="float"
    AnimationsEnabled="{true | false}"
    CenterPointOffset="Vector3"
    CenterPointPercent="Vector3"
    ColorFilter="Color"
    Content="Image object"
    DebugOutline="Color"
    ErrorImage="Image object"
    FocusOrder="int"
    HorizontalAlignment="{Center | Far | Fill | Near}"
    Layout="{Anchor | Center | Dock | Fill | Form | Grid | HorizontalFlow | Rotate | Scale | VerticalFlow}"
    LayoutInput="LayoutInput"
    MaintainAspectRatio="{true | false}"
    Margins="Inset"
    MaximumSize="Size"
    MinimumSize="Size"
    MouseInteractive="{true | false}"
    Name="string"
    Navigation="NavigationPolicies enumeration"
    Padding="Inset"
    Rotation="Rotation"
    Scale="Vector3"
    SizingPolicy="{SizeToChildren | SizeToConstraint | SizeToContent}"
    TouchInteractive="{true | false}"
    VerticalAlignment="{Center | Far | Fill | Near}"
    Visible="{true | false}"
>
    <Animations />
    <Children />
    <Layout />
    <LayoutInput />
</Graphic>

Attributes

AcquiringImage

Specifies an Image object to display in place of an image that is being acquired asynchronously. The image must be a local resource that is referenced using the res://, resx://, file://, http://, or https:// protocol.

Note   There is no event that indicates when a graphic has finished loading.

Alpha

Specifies the opacity value for the view item. This value must be between 0.0 and 1.0.

AnimationsEnabled

Specifies whether animations are enabled for the view item and child elements.

Animations

Contains a list of elements that describe an animation. Possible elements are:

Animation

MergeAnimation

SwitchAnimation

TransformAnimation

TransformByAttributeAnimation

CenterPointOffset

Specifies a center point adjustment based on a pixel-offset value when applying a scale or rotation to the view item. This value is applied after the CenterPointPercent value has been applied if both are provided. Use the inline construction for the Vector3 structure.

CenterPointPercent

Specifies a center point adjustment based on a percentage value when applying a scale or rotation to the view item. This value must be between 0 and 1, where a value of 1 equals 100%. Use the inline construction for the Vector3 structure.

Children

Specifies the child elements for a view item. Possible child elements are:

Clip

ColorFill

Graphic

Host

Panel

Repeater

Scroller

Text

Video

ColorFilter

Indicates the Color filter to apply on top of the color of the view item.

Content

Specifies an Image object to display. To display an image that is generated by code, write the image to a file and then specify a reference to it.

DebugOutline

Enables and sets the Color of the debugging outline of the view item.

ErrorImage

Specifies an Image to display in place of an image that failed to be acquired. The image must be a local resource that is referenced using the res://, resx://, or file:// protocol.

FocusOrder

Specifies relative priorities to sibling view items within the container for determining which item has default focus when entering a UI. Values can range from 0 (the highest priority) to Int32.MaxValue (the lowest priority and the default).

HorizontalAlignment

Specifies the horizontal alignment of the content image within the layout rectangle. This value must be a member of the ItemAlignment enumeration.

When set to Fill, the image is stretched horizontally to fill the maximum constraint (or the maximum width that maintains the aspect ratio if the MaintainAspectRatio property is true). When set to Near, Far, or Center, and the image is larger than the layout rectangle, the image is cropped to fit and the alignment value determines which region of the image to preserve.

Layout

Specifies the current layout associated with this view item. You can use the inline construction or expanded syntax with the following child elements that define a layout:

AnchorLayout

DockLayout

FlowLayout

GridLayout

RotateLayout

ScaleLayout

LayoutInput

Specifies the layout input for use by parent layouts. You can use the inline construction to specify a reference to a layout element, or use expanded syntax with the following child elements that define input:

AnchorLayoutInput

DockLayoutInput

FormLayoutInput

MaintainAspectRatio

Indicates whether to maintain relative width and height ratio when displaying the image.

Margins

An Inset structure that specifies extra spacing around the view item.

MaximumSize

Specifies the maximum Size, in pixels. If a maximum size is not specified or the maximum size is set to zero, the size will not be restricted.

MinimumSize

Specifies the minimum Size, in pixels. If a maximum size is not specified or the maximum size is set to zero, the size will not be restricted.

MouseInteractive

Determines whether the view item can receive and react to mouse input.

Name

Identifies this element.

Navigation

Specifies how the view item should behave during directional navigation. This value must be a member of the NavigationPolicies enumeration.

Padding

An Inset structure that specifies the extra spacing, in pixels, between the view item and its child elements.

Rotation

Applies a Rotation to the view item. Use the inline construction for this element.

Scale

A Vector3 structure that applies a scaling factor to the view item. Use the inline construction for this element.

SizingPolicy

Specifies how to size the image based on content. This value must be a member of the SizingPolicy enumeration.

TouchInteractive

Determines whether the view item can receive and react to touch input.

VerticalAlignment

Specifies the vertical alignment of the image within the layout rectangle. This value must be a member of the ItemAlignment enumeration.

Visible

Indicates whether the view item is visible.

Public Instance Methods

MethodDescription
AttachAnimationDynamically adds an animation to the view item.
DetachAnimationDynamically removes an animation from the view item.
ForceContentChangeManually forces a content change for animations.
NavigateIntoRequests navigation into the view item to send focus to the view item or one of its children.

Remarks

Windows Media Center displays default placeholder images when images are being downloaded and when an error occurs during download. Windows Media Center applications can use the AcquiringImage and ErrorImage attributes of the Graphic element to specify custom images, provided these images are referenced locally.

Windows Media Center web applications must use the default placeholder images because these applications cannot access local resources due to security concerns. These applications also cannot specify custom web images because they would need to be downloaded first; that is when the placeholders are displayed. However, you can choose to turn off the default placeholders and display something other than an image, such as a colorfill.

Locally-installed Windows Media Center applications can choose to specify local files or web-based files for error and acquiring images, or not specify anything and rely on default error and acquiring images. When specifying local files, if the files do not exist, the MCML parser displays an error and the application fails to start. When specifiying web-based files, if the files do not exist, the MCML parser automatically substitutes the default error and acquiring images.

Animated GIFs are not supported in MCML.

Requirements

Platform: Windows Vista Ultimate, Windows Vista Home Premium, and later

See Also

Show: