如何在 C# 中全局设置 RenderOptions?
How to set RenderOptions globally in C#?
我对像素化图像有问题,后来发现 RenderOptions.BitmapScalingMode="HighQuality"
解决了问题。有没有办法全局设置它而不是将代码添加到每个单独的图像?
只需从全局适用的样式设置它:
<Application x:Class="SO_72015119.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Style TargetType="{x:Type Image}" BasedOn="{StaticResource {x:Type Image}}">
<Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality" />
</Style>
</Application.Resources>
</Application>
我对像素化图像有问题,后来发现 RenderOptions.BitmapScalingMode="HighQuality"
解决了问题。有没有办法全局设置它而不是将代码添加到每个单独的图像?
只需从全局适用的样式设置它:
<Application x:Class="SO_72015119.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Style TargetType="{x:Type Image}" BasedOn="{StaticResource {x:Type Image}}">
<Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality" />
</Style>
</Application.Resources>
</Application>