Note that there are some explanatory texts on larger screens.

plurals
  1. POButton Template does not render Image clearly
    primarykey
    data
    text
    <p>Here is my button template,</p> <pre><code>&lt;Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" RenderDefaulted="{TemplateBinding IsDefaulted}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}"&gt; &lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="Auto"/&gt; &lt;ColumnDefinition/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Image Source="{TemplateBinding ImageSource}" RenderOptions.BitmapScalingMode="NearestNeighbor" SnapsToDevicePixels="True" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" /&gt; &lt;ContentPresenter Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True"/&gt; &lt;/Grid&gt; &lt;/Microsoft_Windows_Themes:ButtonChrome&gt; </code></pre> <p>Now you can see as per this question <a href="https://stackoverflow.com/questions/592017/my-images-are-blurry-why-isnt-wpfs-snapstodevicepixels-working">My Images are blurry on StackOverflow</a> I tried ..</p> <pre><code>RenderOptions.BitmapScalingMode="NearestNeighbor" </code></pre> <p>On all levels, grid, chrome .. and tried various combinations of SnapsToDevicePixels but images just wont show up correctly. I set Stretch=None, image is aligned at center, still why it stretches automatically?</p> <p>here is the output and its very frustrating.</p> <p><a href="http://akashkava.com/blog/wp-content/uploads/2009/12/BadButton.PNG" rel="nofollow noreferrer">Bad Image on WPF http://akashkava.com/blog/wp-content/uploads/2009/12/BadButton.PNG</a></p> <p>Actual size of the image is 16x16 but I some how figured out by using Windows Maginifier that no matter what I do, the image is actually trying to render as 20x20, for the bigger images its even cropping the right most and bottom part. I think image should be rendered correctly 16x16 when Stretch=None, can anyone clarify whats problem here?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload