Skip to content

Instantly share code, notes, and snippets.

@ScottIsAFool
Created August 18, 2014 14:27
Show Gist options
  • Save ScottIsAFool/d3ef5dfed4ff534f8de8 to your computer and use it in GitHub Desktop.
Save ScottIsAFool/d3ef5dfed4ff534f8de8 to your computer and use it in GitHub Desktop.
EmptyButtonStyle with Tilt
<Style x:Key="EmptyButtonStyle"
TargetType="ButtonBase">
<Setter Property="Background"
Value="Transparent" />
<Setter Property="Padding"
Value="0" />
<Setter Property="HorizontalContentAlignment"
Value="Stretch" />
<Setter Property="HorizontalAlignment"
Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ButtonBase">
<Border Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition From="Pressed"
To="PointerOver">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Container" />
</Storyboard>
</VisualTransition>
<VisualTransition From="PointerOver"
To="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Container" />
</Storyboard>
</VisualTransition>
<VisualTransition From="Pressed"
To="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Container" />
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver" />
<VisualState x:Name="Pressed">
<Storyboard>
<PointerDownThemeAnimation Storyboard.TargetName="Container" />
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="Container" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
x:Name="Container"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment