PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, May 5, 2022

[FIXED] How to set RenderOptions globally in C#?

 May 05, 2022     c#, image, wpf     No comments   

Issue

i had problems with pixelated images and found later that RenderOptions.BitmapScalingMode="HighQuality" solves the problem. Is there a way to set this globally instead of adding the code to each individual image?


Solution

Simply set it from a globally applicable style:

<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>


Answered By - Orace
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing