Table of Contents

Class Image

Namespace
Avalonia.Controls
Assembly
Avalonia.Controls.dll

Displays a Bitmap image.

public class Image : Control, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
Inheritance
Image
Implements
Inherited Members
Extension Methods

Constructors

Image()

public Image()

Fields

BlendModeProperty

Defines the BlendMode property.

public static readonly StyledProperty<BitmapBlendingMode> BlendModeProperty

Field Value

StyledProperty<BitmapBlendingMode>

SourceProperty

Defines the Source property.

public static readonly StyledProperty<IImage?> SourceProperty

Field Value

StyledProperty<IImage>

StretchDirectionProperty

Defines the StretchDirection property.

public static readonly StyledProperty<StretchDirection> StretchDirectionProperty

Field Value

StyledProperty<StretchDirection>

StretchProperty

Defines the Stretch property.

public static readonly StyledProperty<Stretch> StretchProperty

Field Value

StyledProperty<Stretch>

Properties

BlendMode

Gets or sets the blend mode for the image.

public BitmapBlendingMode BlendMode { get; set; }

Property Value

BitmapBlendingMode

BypassFlowDirectionPolicies

Gets a value indicating whether control bypass FlowDirecton policies.

protected override bool BypassFlowDirectionPolicies { get; }

Property Value

bool

Remarks

Related to FlowDirection system and returns false as default, so if FlowDirection is RTL then control will get a mirror presentation. For controls that want to avoid this behavior, override this property and return true.

Source

Gets or sets the image that will be displayed.

[Content]
public IImage? Source { get; set; }

Property Value

IImage

Stretch

Gets or sets a value controlling how the image will be stretched.

public Stretch Stretch { get; set; }

Property Value

Stretch

StretchDirection

Gets or sets a value controlling in what direction the image will be stretched.

public StretchDirection StretchDirection { get; set; }

Property Value

StretchDirection

Methods

ArrangeOverride(Size)

Positions child elements as part of a layout pass.

protected override Size ArrangeOverride(Size finalSize)

Parameters

finalSize Size

The size available to the control.

Returns

Size

The actual size used.

MeasureOverride(Size)

Measures the control.

protected override Size MeasureOverride(Size availableSize)

Parameters

availableSize Size

The available size.

Returns

Size

The desired size of the control.

OnCreateAutomationPeer()

Returns a new, type-specific AutomationPeer implementation for the control.

protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer

The type-specific AutomationPeer implementation.

Render(DrawingContext)

Renders the control.

public override sealed void Render(DrawingContext context)

Parameters

context DrawingContext

The drawing context.