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
Gets or sets 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:
A Brush that can be specified to indicate the control's background color so that chromatic adaptation can occur when appropriate.
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
Gets or sets the opacity at which to render the image when the control is disabled.
public double DisabledOpacity { get; set; }
Property Value
- double:
The opacity at which to render the image when the control is disabled. The default value is
1.0
, meaning don't change opacity when disabled.
Foreground
Gets or sets the foreground Brush, whose color is passed along in the image provider request.
public Brush Foreground { get; set; }
Property Value
OriginalSource
Gets the original Source
image prior to any ImageProvider adaptation.
public ImageSource? OriginalSource { get; }
Property Value
- ImageSource:
The original
Source
image prior to any ImageProvider adaptation.
UseMonochrome
Gets or sets 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 isfalse
.
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)
When overridden in a derived class, positions child elements and determines a size for a FrameworkElement derived class.
protected override Size ArrangeOverride(Size finalSize)
Parameter | Type | Description |
---|---|---|
finalSize | Size | The final area within the parent that this element should use to arrange itself and its children. |
Returns
- Size:
The actual size used.
CreateImageProviderRequest(ImageProvider?)
Creates an ImageProviderRequest.
protected virtual ImageProviderRequest? CreateImageProviderRequest(ImageProvider? imageProvider)
Parameter | Type | Description |
---|---|---|
imageProvider | ImageProvider | The ImageProvider to which the request will be made. |
Returns
- ImageProviderRequest:
The ImageProviderRequest that was created.
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
Identifies the BackgroundHint dependency property. This field is read-only.
public static readonly DependencyProperty BackgroundHintProperty
DisabledOpacityProperty
Identifies the DisabledOpacity dependency property. This field is read-only.
public static readonly DependencyProperty DisabledOpacityProperty
ForegroundProperty
Identifies the Foreground dependency property. This field is read-only.
public static readonly DependencyProperty ForegroundProperty
OriginalSourceProperty
Identifies the OriginalSource dependency property. This field is read-only.
public static readonly DependencyProperty OriginalSourceProperty
UseMonochromeProperty
Identifies the UseMonochrome dependency property. This field is read-only.
public static readonly DependencyProperty UseMonochromeProperty