In This Article

DynamicImage Class

Represents a dynamic Image control implementation that supports auto-grayscaling the image when the control is disabled.

public class DynamicImage : Image
Inheritance:
object Visual UIElement FrameworkElement Image object

Constructors

DynamicImage()

Initializes an instance of the class.

public DynamicImage()

Properties

BackgroundHint

A Brush that can be specified to indicate the control's background color so that chromatic adaptation can occur when appropriate.

public Brush? BackgroundHint { get; set; }

Property Value

Brush

Remarks

This property is only used when the image provider's ChromaticAdaptationMode property is set to ImageChromaticAdaptationMode.Always and can be left null to use the current theme's default background color for chromatic adaptation logic instead.

DisabledOpacity

The opacity at which to render the image when the control is disabled.

public double DisabledOpacity { get; set; }

Property Value

double:

The default value is 1.0, meaning don't change opacity when disabled.

Foreground

The foreground Brush, whose color is passed along in the image provider request.

public Brush? Foreground { get; set; }

Property Value

Brush

OriginalSource

The original Source image prior to any ImageProvider adaptation.

public ImageSource? OriginalSource { get; }

Property Value

ImageSource

UseMonochrome

Indicates whether the ImageSource value in the Source property should be rendered as monochrome.

public bool UseMonochrome { get; set; }

Property Value

bool:

true if the ImageSource value in the Source property should be rendered as monochrome; otherwise, false. The default value is false.

Remarks

When this property is true, the resulting monochrome image will be in the control's current foreground color (gathered from the Foreground property).

Methods

ArrangeOverride(Size?)

Arranges and sizes an image control.

protected override Size? ArrangeOverride(Size? finalSize)
Parameter Type Description
finalSize Size

Returns

Size:

The size of the control.

CreateImageProviderRequest(ImageProvider?)

Creates and returns an ImageProviderRequest.

protected virtual ImageProviderRequest? CreateImageProviderRequest(ImageProvider? imageProvider)
Parameter Type Description
imageProvider ImageProvider

The ImageProvider to which the request will be made.

Returns

ImageProviderRequest

OnDpiChanged(DpiScale, DpiScale)

Called when the DPI at which this Image is rendered changes.

protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi)
Parameter Type Description
oldDpi DpiScale

The previous DPI scale setting.

newDpi DpiScale

The new DPI scale setting.

OnInitialized(EventArgs)

Raises the Initialized event. This method is invoked whenever IsInitialized is set to true internally.

protected override void OnInitialized(EventArgs e)
Parameter Type Description
e EventArgs

The RoutedEventArgs that contains the event data.

OnRender(DrawingContext)

Occurs when the element is rendered.

protected override void OnRender(DrawingContext drawingContext)
Parameter Type Description
drawingContext DrawingContext

The DrawingContext to use.

Fields

BackgroundHintProperty

Defines the BackgroundHint property.

public static readonly DependencyProperty BackgroundHintProperty

DisabledOpacityProperty

Defines the DisabledOpacity property.

public static readonly DependencyProperty DisabledOpacityProperty

ForegroundProperty

Defines the Foreground property.

public static readonly DependencyProperty ForegroundProperty

OriginalSourceProperty

Defines the OriginalSource property.

public static readonly DependencyProperty OriginalSourceProperty

UseMonochromeProperty

Defines the UseMonochrome property.

public static readonly DependencyProperty UseMonochromeProperty

Extension Methods