DpiPrescaleThemedImageSourceConverter Class

Visual Studio 2015
 

Converts an ImageSource into another ImageSource. If the input image is a BitmapSource, the transformed BitmapSource has its halo color mapped to the given background color and is conditionally rendered as disabled. The resulting image is then pre-scaled on High DPI to the largest zoom multiple of 100% smaller than the DPI zoom. This converter chains the behavior of ThemedImageSourceConverter and DpiPrescaleImageSourceConverter.

Namespace:   Microsoft.VisualStudio.PlatformUI
Assembly:  Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)


public ref class DpiPrescaleThemedImageSourceConverter : DpiPrescaleThemedImageSourceConverter

NameDescription
System_CAPS_pubmethodDpiPrescaleThemedImageSourceConverter()

Initializes a new instance of DpiPrescaleThemedImageSourceConverter.

NameDescription
System_CAPS_protpropertyDpiHelper

Gets an instance of the DpiHelper.(Overrides DpiPrescaleThemedImageSourceConverter::DpiHelper.)

NameDescription
System_CAPS_protmethodConvert(ImageSource^, Color, Boolean, Object^, CultureInfo^)

Converts the image.(Inherited from DpiPrescaleThemedImageSourceConverter.)

System_CAPS_pubmethodConvert(array<Object^>^, Type^, Object^, CultureInfo^)

Microsoft internal use only.(Inherited from MultiValueConverter<T1, T2, T3, TTarget>.)

System_CAPS_protmethodConvertBack(TTarget, T1, T2, T3, Object^, CultureInfo^)

Microsoft internal use only.(Inherited from MultiValueConverter<T1, T2, T3, TTarget>.)

System_CAPS_pubmethodConvertBack(Object^, array<Type^>^, Object^, CultureInfo^)

Microsoft internal use only.(Inherited from MultiValueConverter<T1, T2, T3, 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_protmethodMakeConverterFunctionNotDefinedException(String^)

An exception thrown when the converter function isn’t defined.(Inherited from MultiValueConverterBase<TTarget>.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_protmethodValidateConvertBackParameters(Object^, array<Type^>^)

Validates the parameters passed to IMultiValueConverter.ConvertBack.(Inherited from MultiValueConverterBase<TTarget>.)

System_CAPS_protmethodValidateConvertParameters(array<Object^>^, Type^)

Validates the parameters passed to IMultiValueConverter.Convert.(Inherited from MultiValueConverterBase<TTarget>.)

A common usage pattern can look like this:

<imaging:DpiPrescaleThemedImageSourceConverter x:Key="DpiPrescaleThemedImageSourceConverter" />
....
    <Image UseLayoutRounding="True" SnapsToDevicePixels="True" Width="16" Height="16">
        <Image.Source>  
            <MultiBinding Converter="{StaticResource DpiPrescaleThemedImageSourceConverter}">
                <Binding Path="Icon" />
                <Binding Path="(imaging:ImageThemingUtilities.ImageBackgroundColor)" RelativeSource="{RelativeSource Self}" />
                <Binding Source="{x:Static utilities:Boxes.BooleanTrue}" />
        </MultiBinding>
    </Image.Source>

Where the image dimensions aren't known at compile time, instead of specifying exact Width/Height properties, a layout transform can be specified on the image like this:

<Image.LayoutTransform>
    <ScaleTransform ScaleX="{x:Static util:DpiHelper.Default.PreScaledImageLayoutTransformScaleX}" ScaleY="{x:Static util:DpiHelper.Default.PreScaledImageLayoutTransformScaleY}" />
</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.

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: