Skip to content

Instantly share code, notes, and snippets.

@robfe
Created May 6, 2011 15:31
Show Gist options
  • Save robfe/959164 to your computer and use it in GitHub Desktop.
Save robfe/959164 to your computer and use it in GitHub Desktop.
Fancy curvy shadow style for a ContentControl
<Style x:Key="ShadowBorder" TargetType="ContentControl">
<Setter Property="Foreground" Value="#FF000000"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContentControl">
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid Margin="2,1,2,-3" RenderTransformOrigin="0.5,0">
<Grid.RenderTransform>
<CompositeTransform ScaleY="1.03" ScaleX="1.02"/>
</Grid.RenderTransform>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="15"/>
</Grid.RowDefinitions>
<Grid.Effect>
<BlurEffect Radius="10"/>
</Grid.Effect>
<Rectangle Fill="{TemplateBinding BorderBrush}"/>
<Path Data="M0,0 L10,0 L10,10 C8.333333,9.333333 7.3667073,8 5,8 C2.6332927,8 1.6666666,9.333333 0,10 z" Fill="{TemplateBinding BorderBrush}" Stretch="Fill" UseLayoutRounding="False" RenderTransformOrigin="0.5,0" Grid.Row="1"/>
</Grid>
<ContentPresenter Cursor="{TemplateBinding Cursor}" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment