WPF button pixelated on one site

Each button with the following style has pixelation on the desired site. You can see this clearly in the selected (blue) line:

enter image description here

This is the part of my code that is causing the problem (something screwed up the formatting to fix it a bit, sorry!):

<Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border> <Border.Background> <VisualBrush> <VisualBrush.Visual> <Grid Width="80" Height="20"> <Grid.RowDefinitions> <RowDefinition Height="2*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Rectangle Grid.RowSpan="2" RadiusX="13" RadiusY="13"> <Rectangle.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop Color="LightGray" Offset="0"/> <GradientStop Color="Gray" Offset="1"/> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> <Rectangle Margin="3,2" RadiusX="8" RadiusY="12"> <Rectangle.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop Color="#dfff" Offset="0"/> <GradientStop Color="#0fff" Offset="1"/> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> </Grid> </VisualBrush.Visual> </VisualBrush> </Border.Background> <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </Border> </ControlTemplate> </Setter.Value> </Setter> 

Does anyone have an idea why the buttons are pixelated on the right site?

+4
source share
1 answer

I don't think the problem is in your Button style. Here is what your style looks like in my project:

enter image description here

Can your buttons inherit style from other templates? (rectangle, border, etc.)

+3
source

All Articles