Skip to content

Commit

Permalink
DPI fix for MetroToggleButton and use CornerRadius property
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Feb 22, 2015
1 parent cd31273 commit b83757f
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions MahApps.Metro/Styles/Controls.Buttons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@
BorderThickness="{TemplateBinding BorderThickness}"
Background="{x:Null}"
CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ButtonHelper.CornerRadius), Mode=OneWay}" />
<Rectangle x:Name="DisabledVisualElement"
Fill="{DynamicResource ControlsDisabledBrush}"
IsHitTestVisible="false"
Opacity="0"
RadiusY="3"
RadiusX="3" />
<Border x:Name="DisabledVisualElement"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Background="{DynamicResource ControlsDisabledBrush}"
IsHitTestVisible="false"
Opacity="0"
CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ButtonHelper.CornerRadius), Mode=OneWay}" />
<ContentPresenter x:Name="contentPresenter"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
RecognizesAccessKey="True"
Expand Down Expand Up @@ -691,6 +691,8 @@

<Style TargetType="ToggleButton"
x:Key="MetroToggleButton">
<Setter Property="Controls:ButtonHelper.CornerRadius"
Value="3" />
<Setter Property="Background"
Value="{DynamicResource GrayBrush10}" />
<Setter Property="BorderBrush"
Expand All @@ -714,34 +716,38 @@
<ControlTemplate TargetType="ToggleButton">
<Grid>
<Border x:Name="Background"
Background="{TemplateBinding Background}"
CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ButtonHelper.CornerRadius), Mode=OneWay}" />
<Border x:Name="Border"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
CornerRadius="3" />
<Rectangle x:Name="DisabledVisualElement"
Fill="{DynamicResource WhiteBrush}"
IsHitTestVisible="false"
Opacity="0"
RadiusY="3"
RadiusX="3" />
Background="{x:Null}"
CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ButtonHelper.CornerRadius), Mode=OneWay}" />
<Border x:Name="DisabledVisualElement"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Background="{DynamicResource ControlsDisabledBrush}"
IsHitTestVisible="false"
Opacity="0"
CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ButtonHelper.CornerRadius), Mode=OneWay}" />
<ContentPresenter x:Name="contentPresenter"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
RecognizesAccessKey="True"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked"
Value="True">
<Setter TargetName="Background"
<Setter TargetName="Border"
Property="BorderThickness"
Value="2" />
<Setter TargetName="Background"
Property="Background"
Value="{DynamicResource GrayBrush2}" />
<Setter TargetName="Background"
<Setter TargetName="Border"
Property="BorderBrush"
Value="{DynamicResource GrayBrush5}" />
</Trigger>
Expand Down Expand Up @@ -775,10 +781,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 b83757f

Please # to comment.