Share via


DpiPrescaleImageSourceConverter Class

Definition

Caution

Use the Visual Studio image service and/or Microsoft.VisualStudio.Imaging.CrispImage instead.

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

public ref class DpiPrescaleImageSourceConverter : Microsoft::VisualStudio::Imaging::Dpi::DpiPrescaleImageSourceConverter
[Windows::Foundation::Metadata::WebHostHidden]
class DpiPrescaleImageSourceConverter : Microsoft::VisualStudio::Imaging::Dpi::DpiPrescaleImageSourceConverter
public class DpiPrescaleImageSourceConverter : Microsoft.VisualStudio.Imaging.Dpi.DpiPrescaleImageSourceConverter
[System.Obsolete("Use the Visual Studio image service and/or Microsoft.VisualStudio.Imaging.CrispImage instead.")]
public class DpiPrescaleImageSourceConverter : Microsoft.VisualStudio.Imaging.Dpi.DpiPrescaleImageSourceConverter
type DpiPrescaleImageSourceConverter = class
    inherit DpiPrescaleImageSourceConverter
[<System.Obsolete("Use the Visual Studio image service and/or Microsoft.VisualStudio.Imaging.CrispImage instead.")>]
type DpiPrescaleImageSourceConverter = class
    inherit DpiPrescaleImageSourceConverter
Public Class DpiPrescaleImageSourceConverter
Inherits DpiPrescaleImageSourceConverter
Inheritance
Attributes

Remarks

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.

Constructors

DpiPrescaleImageSourceConverter()

Initializes a new instance if DpiPrescaleImageSourceConverter.

Properties

DpiHelper

Gets the DpiHelper.

Methods

Convert(ImageSource, Object, CultureInfo)

Converts the image.

(Inherited from DpiPrescaleImageSourceConverter)
Convert(Object, Type, Object, CultureInfo)

Microsoft internal use only.

(Inherited from ValueConverter<TSource,TTarget>)
Convert(TSource, Object, CultureInfo)

Microsoft internal use only.

(Inherited from ValueConverter<TSource,TTarget>)
ConvertBack(Object, Type, Object, CultureInfo)

Microsoft internal use only.

(Inherited from ValueConverter<TSource,TTarget>)
ConvertBack(TTarget, Object, CultureInfo)

Microsoft internal use only.

(Inherited from ValueConverter<TSource,TTarget>)

Applies to