DpiPrescaledImageExtension Class

Visual Studio 2015
 

This class is derived from a 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%.

Namespace:   Microsoft.VisualStudio.Imaging.Dpi
Assembly:  Microsoft.VisualStudio.Imaging (in Microsoft.VisualStudio.Imaging.dll)


public ref class DpiPrescaledImageExtension : MarkupExtension

NameDescription
System_CAPS_pubmethodDpiPrescaledImageExtension()

Initializes a new instance of DpiPrescaledImageExtension.

System_CAPS_pubmethodDpiPrescaledImageExtension(String^)

Initializes a new instance of DpiPrescaledImageExtension with the specified URI.

NameDescription
System_CAPS_protpropertyPrescalingConverter

Gets an instance of the DpiPrescaleImageSourceConverter.

System_CAPS_pubpropertyUri

Gets or sets the URI.

NameDescription
System_CAPS_pubmethodEquals(Object^)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodProvideValue(IServiceProvider^)
System_CAPS_pubmethodToString()

(Inherited from Object.)

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: