Partager via


DpiPrescaledImageExtension Class

Definition

Caution

Callers should use the CrispImage control for properly scaled images. Additionally, in some cases this markup extension can cause crashes.

MarkupExtension class that can be used to declare image sources in xaml and have the image pre-scaled for High DPI at zoom levels higher than 200%, using NearestNeighbor up to the largest multiple of 100%.

A common usage pattern can look like this: or <Image.LayoutTransform></Image.LayoutTransform>

Note that when using image pre-scaling, either the original image size has to be specified, or a reverse layout transform has to be applied to the result, to maintain the desired original image size

public ref class DpiPrescaledImageExtension : System::Windows::Markup::MarkupExtension
public class DpiPrescaledImageExtension : System.Windows.Markup.MarkupExtension
[System.Obsolete("Callers should use the CrispImage control for properly scaled images. Additionally, in some cases this markup extension can cause crashes.")]
public class DpiPrescaledImageExtension : System.Windows.Markup.MarkupExtension
type DpiPrescaledImageExtension = class
    inherit MarkupExtension
[<System.Obsolete("Callers should use the CrispImage control for properly scaled images. Additionally, in some cases this markup extension can cause crashes.")>]
type DpiPrescaledImageExtension = class
    inherit MarkupExtension
Public Class DpiPrescaledImageExtension
Inherits MarkupExtension
Inheritance
DpiPrescaledImageExtension
Derived
Attributes

Remarks

A common usage pattern can look like this:

<Image Source="{imaging:DpiPrescaledImage resources/MyImage.png}" Width="16" Height="16" />  

or

<Image Source="{imaging:DpiPrescaledImage resources/MyImage.png}" Stretch="None">  
    <Image.LayoutTransform>  
         <ScaleTransform ScaleX="{x:Static utilities:DpiHelper.Default.PreScaledImageLayoutTransformScaleX}" ScaleY="{x:Static utilities:DpiHelper.Default.PreScaledImageLayoutTransformScaleY}" />  
       </Image.LayoutTransform>  
     </Image>  

Note that when using image pre-scaling, either the original image size has to be specified, or a reverse layout transform has to be applied to the result, to maintain the desired original image size.

Constructors

DpiPrescaledImageExtension()

Initializes a new instance of DpiPrescaledImageExtension.

DpiPrescaledImageExtension(String)

Initializes a new instance of DpiPrescaledImageExtension with the specified URI.

Properties

PrescalingConverter

Gets an instance of the DpiPrescaleImageSourceConverter.

Uri

Gets or sets the URI.

Methods

ProvideValue(IServiceProvider)

Applies to