aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Components/Ripple.xaml
blob: e2aaefd67ba32c5b161f2648a437ec5d2d17cc4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                    xmlns:converters="clr-namespace:Tango.Touch.Converters"
                    xmlns:local="clr-namespace:Tango.Touch.Components">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Resources/Colors.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type local:Ripple}">
        <Style.Resources>
            <converters:SizeToRectConverter x:Key="SizeToRectConverter" />
        </Style.Resources>
        <Setter Property="ClipToBounds" Value="True"></Setter>
        <Setter Property="Background" Value="Transparent"></Setter>
        <Setter Property="RippleBrush" Value="{StaticResource RippleLightBrush}"></Setter>
        <Setter Property="HorizontalAlignment" Value="Stretch"></Setter>
        <Setter Property="VerticalAlignment" Value="Stretch"></Setter>
        <Setter Property="IsHitTestVisible" Value="True"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:Ripple}">
                    <Border CornerRadius="{TemplateBinding CornerRadius}">
                        <Border.Clip>
                            <RectangleGeometry RadiusX="{Binding RelativeSource={RelativeSource AncestorType=local:Ripple},Path=CornerRadius.TopLeft}" RadiusY="{Binding RelativeSource={RelativeSource AncestorType=local:Ripple},Path=CornerRadius.BottomRight}" Rect="{Binding RelativeSource={RelativeSource AncestorType=local:Ripple},Path=RenderSize,Converter={StaticResource SizeToRectConverter}}"></RectangleGeometry>
                        </Border.Clip>
                        <Grid x:Name="PART_grid">
                            <ContentPresenter Content="{TemplateBinding Content}" />
                            <Canvas>
                                <Ellipse IsHitTestVisible="False" x:Name="PART_ellipse" RenderTransformOrigin="0.5,0.5" Fill="{TemplateBinding RippleBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" Height="{TemplateBinding ActualHeight}" Width="{TemplateBinding ActualHeight}">
                                    <Ellipse.RenderTransform>
                                        <ScaleTransform x:Name="PART_scale" ScaleX="0" ScaleY="0"></ScaleTransform>
                                    </Ellipse.RenderTransform>
                                </Ellipse>
                            </Canvas>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>