DpiPrescaleImageSourceConverter Class

Visual Studio 2015
 

Converts an ImageSource into another ImageSource, pre-scaled on High DPI to the largest zoom multiple of 100% smaller than the DPI zoom.///

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


public ref class DpiPrescaleImageSourceConverter : ValueConverter<ImageSource^, ImageSource^>

NameDescription
System_CAPS_pubmethodDpiPrescaleImageSourceConverter()

Initializes a new instance of DpiPrescaleImageSourceConverter.

NameDescription
System_CAPS_protpropertyDpiHelper

Gets the default DpiHelper.

A common usage pattern can look like this:

<imaging:DpiPrescaleImageSourceConverter x:Key="DpiPrescaleImageSourceConverter" />
<Image Source="{Binding Path=SelectedItem.Image, Converter={StaticResource DpiPrescaleImageSourceConverter}}" Width="16" Height="16" />

or

<Image Source="{Binding Path=SelectedItem.Image, Converter={StaticResource DpiPrescaleImageSourceConverter}}" 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: