Class Image
Represents a control that displays an image. The image is specified as an image file in several possible formats, see Remarks.
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
public sealed class Image : FrameworkElement
Examples
Image image = new Image();
image.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appx:/MyImage.png"));
MyStackPanel.Children.Add(image);
Fields
| Improve this Doc View SourceSourceProperty
Identifies the Source dependency property.
Declaration
public static readonly DependencyProperty SourceProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
StretchProperty
Identifies the Stretch dependency property
Declaration
public static readonly DependencyProperty StretchProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceINTERNAL_DomImageElement
Declaration
public object INTERNAL_DomImageElement { get; }
Property Value
Type | Description |
---|---|
System.Object |
Source
Gets or sets the source for the image.
Returns an object that represents the image source file for the drawn image. Typically you set this with a BitmapSource object, constructed with the that describes the path to a valid image source file.
Declaration
public ImageSource Source { get; set; }
Property Value
Type | Description |
---|---|
ImageSource |
Stretch
Gets or sets a value that describes how an Image should be stretched to fill the destination rectangle.
Returns a value of the Stretch enumeration that specifies how the source image is applied if the Height and Width of the Image are specified and are different than the source image's height and width. The default value is Uniform.
Declaration
public Stretch Stretch { get; set; }
Property Value
Type | Description |
---|---|
Stretch |
Methods
| Improve this Doc View SourceCreateDomElement(Object, out Object)
Declaration
public override object CreateDomElement(object parentRef, out object domElementWhereToPlaceChildren)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parentRef | |
System.Object | domElementWhereToPlaceChildren |
Returns
Type | Description |
---|---|
System.Object |
Overrides
| Improve this Doc View SourceINTERNAL_AttachToDomEvents()
Declaration
public override void INTERNAL_AttachToDomEvents()
Overrides
| Improve this Doc View SourceINTERNAL_DetachFromDomEvents()
Declaration
public override void INTERNAL_DetachFromDomEvents()
Overrides
Events
| Improve this Doc View SourceImageFailed
Occurs when there is an error associated with image retrieval or format.
Declaration
public event EventHandler<ExceptionRoutedEventArgs> ImageFailed
Event Type
Type | Description |
---|---|
System.EventHandler<ExceptionRoutedEventArgs> |
ImageOpened
Occurs when the image source is downloaded and decoded with no failure.
Declaration
public event EventHandler<RoutedEventArgs> ImageOpened
Event Type
Type | Description |
---|---|
System.EventHandler<RoutedEventArgs> |