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.PlatformUI
Assembly:  Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)


public class DpiPrescaleImageSourceConverter : DpiPrescaleImageSourceConverter

NameDescription
System_CAPS_pubmethodDpiPrescaleImageSourceConverter()

Initializes a new instance if DpiPrescaleImageSourceConverter.

NameDescription
System_CAPS_protpropertyDpiHelper

Gets the DpiHelper.(Overrides DpiPrescaleImageSourceConverter.DpiHelper.)

NameDescription
System_CAPS_protmethodConvert(ImageSource, Object, CultureInfo)

Converts the image.(Inherited from DpiPrescaleImageSourceConverter.)

System_CAPS_pubmethodConvert(Object, Type, Object, CultureInfo)

Microsoft internal use only.(Inherited from ValueConverter<TSource, TTarget>.)

System_CAPS_protmethodConvertBack(TTarget, Object, CultureInfo)

Microsoft internal use only.(Inherited from ValueConverter<TSource, TTarget>.)

System_CAPS_pubmethodConvertBack(Object, Type, Object, CultureInfo)

Microsoft internal use only.(Inherited from ValueConverter<TSource, TTarget>.)

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_pubmethodToString()

(Inherited from Object.)

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: