Skip to main content

ImageContentModes

Namespace: BlazorNative.Components

Converts ImageContentMode to the lowercase string the Android and iOS shells read.

public static class ImageContentModes

Inheritance Object → ImageContentModes
Attributes NullableContextAttribute, NullableAttribute, ExtensionAttribute

Remarks:

BnImage calls this for you — you need it only if you are building a component that speaks to the shells directly.

Methods​

ToWireValue(ImageContentMode)​

The value for value: one of "contain", "cover", "stretch" or "center".

public static string ToWireValue(ImageContentMode value)

Parameters​

value ImageContentMode
The mode to convert.

Returns​

String
The lowercase string both platforms parse.

Exceptions​

ArgumentOutOfRangeException
The value is not one of the four declared modes — for example an integer cast to the enum.

ToWireValue(ImageContentMode?)​

As ImageContentModes.ToWireValue(ImageContentMode), but null maps to null — which a component emits as no value at all, leaving the platform's default in place.

public static string? ToWireValue(ImageContentMode? value)

Parameters​

value ImageContentMode?
The mode to convert, or null.

Returns​

String?
The lowercase string, or null when value is null.