Skip to content

Commit

Permalink
DPI fix for MetroButton style
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Feb 22, 2015
1 parent 8b96c86 commit 8b3b2cd
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions MahApps.Metro/Styles/Controls.Buttons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,13 @@
<ControlTemplate TargetType="Button">
<Grid>
<Border x:Name="Background"
Background="{TemplateBinding Background}"
CornerRadius="3" />
<Border x:Name="Border"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Background="{x:Null}"
CornerRadius="3" />
<Rectangle x:Name="DisabledVisualElement"
Fill="{DynamicResource ControlsDisabledBrush}"
Expand All @@ -331,18 +335,25 @@
RadiusY="3"
RadiusX="3" />
<ContentPresenter x:Name="contentPresenter"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
RecognizesAccessKey="True"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="controls:ButtonHelper.PreserveTextCase" Value="False">
<Setter TargetName="contentPresenter" Property="Content" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Content, Converter={StaticResource ToUpperConverter}}" />
<Trigger Property="controls:ButtonHelper.PreserveTextCase"
Value="False">
<Setter TargetName="contentPresenter"
Property="Content"
Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Content, Converter={StaticResource ToUpperConverter}}" />
</Trigger>
<Trigger Property="controls:ButtonHelper.PreserveTextCase" Value="True">
<Setter TargetName="contentPresenter" Property="Content" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Content}"/>
<Trigger Property="controls:ButtonHelper.PreserveTextCase"
Value="True">
<Setter TargetName="contentPresenter"
Property="Content"
Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Content}" />
</Trigger >
<Trigger Property="IsMouseOver"
Value="True">
Expand All @@ -358,10 +369,10 @@
</Trigger>
<Trigger Property="IsKeyboardFocusWithin"
Value="True">
<Setter TargetName="Background"
<Setter TargetName="Border"
Property="BorderThickness"
Value="2" />
<Setter TargetName="Background"
<Setter TargetName="Border"
Property="BorderBrush"
Value="{DynamicResource ButtonMouseOverBorderBrush}" />
</Trigger>
Expand Down

0 comments on commit 8b3b2cd

Please # to comment.