Partager via


IXRImage (Compact 2013)

3/28/2014

This class represents a control that displays an image.

Syntax

class IXRImage : public IXRFrameworkElement

Inheritance Hierarchy

IXRDependencyObject

    IXRUIElement

        IXRFrameworkElement

            IXRImage

Methods

Method

Description

IXRImage::AddImageFailedEventHandler

Attaches a delegate to the ImageFailed event for this image. When the image raises the ImageFailed event, this delegate will be invoked.

IXRImage::GetSource

Retrieves the source for this image.

IXRImage::GetStretch

Retrieves a value that describes how an image should be stretched to fill the destination rectangle.

IXRImage::RemoveImageFailedEventHandler

Removes a delegate from the ImageFailed event for this image.

IXRImage::SetSource

Sets the source for this image.

IXRImage::SetStretch

Sets a value that describes how an image should be stretched to fill the destination rectangle.

Thread Safety

Members of this class are thread-safe if you previously called IXRApplication::CreateHostFromXaml and supplied it with an XRWindowCreateParams structure that has AllowsMultipleThreadAccess set to true.

Remarks

If Height and Width are not set by calling the inherited methods IXRFrameworkElement::SetHeight and IXRFrameworkElement::SetWidth, IXRImage appears on-screen with the natural height and width of its source image file.

IXRImage potentially has asynchronous behavior. Until the source is resolved and the image sources decoded, the layout system will render the image object. However, the rendered image will be treated as an element that has 0 size if it did not specify Height and Width, or it will be treated as an empty region on the UI that has the specified size if Height and Width are specified. As soon as the universal resource identifier (URI) of the source of this image is resolved and the image source is decoded, another layout pass is initiated.

XAML for Windows Embedded uses bitmap caching. Therefore, if a requested image was requested at a previous time, the cached and decoded image is used again instead of starting a new request from the URI.

For information about the kinds of image sources and formats that can be used for an IXRImage control, see IXRBitmapImage.

When you create a class instance, use an IXRImagePtr smart pointer instead of a raw interface pointer. For more information, see XRPtr<Interface>.

You can also define an image in Microsoft Silverlight 3 XAML. For information about the differences between XAML in XAML for Windows Embedded and Silverlight 3, see Differences Between Microsoft Silverlight 3 and XAML for Windows Embedded. For more information about how to define this element in the source XAML for your application, see the Image Class on MSDN.

.NET Framework Equivalent

System.Windows.Controls.Image

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for UI Element Management