DpiPrescaledImageExtension Class
This class is derived from a MarkupExtension class that can be used to declare image sources in XAML and have the image pre-scaled for High DPI at zoom levels higher than 200%, using NearestNeighbor up to the largest multiple of 100%.
Assembly: Microsoft.VisualStudio.Imaging (in Microsoft.VisualStudio.Imaging.dll)
System.Windows.Markup::MarkupExtension
Microsoft.VisualStudio.Imaging.Dpi::DpiPrescaledImageExtension
Microsoft.VisualStudio.PlatformUI::DpiPrescaledImageExtension
| Name | Description | |
|---|---|---|
![]() | DpiPrescaledImageExtension() | Initializes a new instance of DpiPrescaledImageExtension. |
![]() | DpiPrescaledImageExtension(String^) | Initializes a new instance of DpiPrescaledImageExtension with the specified URI. |
| Name | Description | |
|---|---|---|
![]() | PrescalingConverter | Gets an instance of the DpiPrescaleImageSourceConverter. |
![]() | Uri | Gets or sets the URI. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object^) | (Inherited from Object.) |
![]() | Finalize() | (Inherited from Object.) |
![]() | GetHashCode() | (Inherited from Object.) |
![]() | GetType() | (Inherited from Object.) |
![]() | MemberwiseClone() | (Inherited from Object.) |
![]() | ProvideValue(IServiceProvider^) | (Overrides MarkupExtension::ProvideValue(IServiceProvider^).) |
![]() | ToString() | (Inherited from Object.) |
A common usage pattern can look like this:
<Image Source="{imaging:DpiPrescaledImage resources/MyImage.png}" Width="16" Height="16" />
or
<Image Source="{imaging:DpiPrescaledImage resources/MyImage.png}" 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.



