DpiPrescaleImageSourceConverter Class
Converts an ImageSource into another ImageSource, pre-scaled on High DPI to the largest zoom multiple of 100% smaller than the DPI zoom.///
Assembly: Microsoft.VisualStudio.Imaging (in Microsoft.VisualStudio.Imaging.dll)
Microsoft.VisualStudio.PlatformUI::ValueConverter<TSource, TTarget>
Microsoft.VisualStudio.Imaging.Dpi::DpiPrescaleImageSourceConverter
Microsoft.VisualStudio.PlatformUI::DpiPrescaleImageSourceConverter
| Name | Description | |
|---|---|---|
![]() | DpiPrescaleImageSourceConverter() | Initializes a new instance of DpiPrescaleImageSourceConverter. |
| Name | Description | |
|---|---|---|
![]() | DpiHelper | Gets the default DpiHelper. |
| Name | Description | |
|---|---|---|
![]() | Convert(ImageSource^, Object^, CultureInfo^) | Converts the image.(Overrides ValueConverter<TSource, TTarget>::Convert(TSource, Object^, CultureInfo^).) |
![]() | Convert(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>.) |
![]() | ConvertBack(Object^, Type^, Object^, CultureInfo^) | Microsoft internal use only.(Inherited from ValueConverter<TSource, TTarget>.) |
![]() | Equals(Object^) | (Inherited from Object.) |
![]() | Finalize() | (Inherited from Object.) |
![]() | GetHashCode() | (Inherited from Object.) |
![]() | GetType() | (Inherited from Object.) |
![]() | MemberwiseClone() | (Inherited from Object.) |
![]() | ToString() | (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.


