DpiPrescaleThemedImageSourceConverter Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
Use Microsoft.VisualStudio.Imaging.CrispImage instead.
Converts an ImageSource into another ImageSource. If the input image ia a BitmapSource, the transformed BitmapSource has its halo color mapped to the given background color and is conditionally rendered as disabled. The resultant 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.
public ref class DpiPrescaleThemedImageSourceConverter : Microsoft::VisualStudio::PlatformUI::MultiValueConverter<System::Windows::Media::ImageSource ^, System::Windows::Media::Color, bool, System::Windows::Media::ImageSource ^>
[Windows::Foundation::Metadata::WebHostHidden]
class DpiPrescaleThemedImageSourceConverter : Microsoft::VisualStudio::PlatformUI::MultiValueConverter<System::Windows::Media::ImageSource, System::Windows::Media::Color, bool, System::Windows::Media::ImageSource const &>
public class DpiPrescaleThemedImageSourceConverter : Microsoft.VisualStudio.PlatformUI.MultiValueConverter<System.Windows.Media.ImageSource,System.Windows.Media.Color,bool,System.Windows.Media.ImageSource>
[System.Obsolete("Use Microsoft.VisualStudio.Imaging.CrispImage instead.")]
public class DpiPrescaleThemedImageSourceConverter : Microsoft.VisualStudio.PlatformUI.MultiValueConverter<System.Windows.Media.ImageSource,System.Windows.Media.Color,bool,System.Windows.Media.ImageSource>
type DpiPrescaleThemedImageSourceConverter = class
inherit MultiValueConverter<ImageSource, Color, bool, ImageSource>
[<System.Obsolete("Use Microsoft.VisualStudio.Imaging.CrispImage instead.")>]
type DpiPrescaleThemedImageSourceConverter = class
inherit MultiValueConverter<ImageSource, Color, bool, ImageSource>
Public Class DpiPrescaleThemedImageSourceConverter
Inherits MultiValueConverter(Of ImageSource, Color, Boolean, ImageSource)
- Inheritance
-
DpiPrescaleThemedImageSourceConverter
- Derived
- Attributes
Remarks
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>
</Image>
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
Constructors
DpiPrescaleThemedImageSourceConverter() |
Initializes a new instance of DpiPrescaleThemedImageSourceConverter. |
Properties
DpiHelper |
Gets the default DpiHelper. |