DpiPrescaleImageSourceConverter Class

Definition

Caution

Use 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::PlatformUI::ValueConverter<System::Windows::Media::ImageSource ^, System::Windows::Media::ImageSource ^>
[Windows::Foundation::Metadata::WebHostHidden]
class DpiPrescaleImageSourceConverter : Microsoft::VisualStudio::PlatformUI::ValueConverter<System::Windows::Media::ImageSource, System::Windows::Media::ImageSource const &>
public class DpiPrescaleImageSourceConverter : Microsoft.VisualStudio.PlatformUI.ValueConverter<System.Windows.Media.ImageSource,System.Windows.Media.ImageSource>
[System.Obsolete("Use Microsoft.VisualStudio.Imaging.CrispImage instead.")]
public class DpiPrescaleImageSourceConverter : Microsoft.VisualStudio.PlatformUI.ValueConverter<System.Windows.Media.ImageSource,System.Windows.Media.ImageSource>
type DpiPrescaleImageSourceConverter = class
    inherit ValueConverter<ImageSource, ImageSource>
[<System.Obsolete("Use Microsoft.VisualStudio.Imaging.CrispImage instead.")>]
type DpiPrescaleImageSourceConverter = class
    inherit ValueConverter<ImageSource, ImageSource>
Public Class DpiPrescaleImageSourceConverter
Inherits ValueConverter(Of ImageSource, ImageSource)
Inheritance
DpiPrescaleImageSourceConverter
Derived
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 of DpiPrescaleImageSourceConverter.

Properties

DpiHelper

Gets the default DpiHelper.

Methods

Convert(ImageSource, Object, CultureInfo)

Converts the image.

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