aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Styles/TouchExpander.xaml
blob: d61203e3b069a46801da35c8b062555743aaea31 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:Tango.Touch.Controls"
                    xmlns:local="clr-namespace:Tango.Touch.Styles">

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

    <Style x:Key="TouchRoundedExpander" TargetType="{x:Type controls:TouchExpander}">
        <Setter Property="Padding" Value="10"></Setter>
        <Setter Property="CornerRadius" Value="20"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:TouchExpander}">
                    <controls:TouchDropShadowBorder Background="{TemplateBinding Background}"  BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" CornerRadius="{TemplateBinding CornerRadius}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <DockPanel Grid.Row="0">
                                <controls:TouchToggleButton CornerRadius="50" RenderTransformOrigin="0.5,0.5" Background="Transparent" EnableDropShadow="False" Width="60" Height="60" DockPanel.Dock="Right" IsChecked="{Binding RelativeSource={RelativeSource AncestorType=controls:TouchExpander},Path=IsExpanded,Mode=TwoWay}">
                                    <controls:TouchToggleButton.RenderTransform>
                                        <RotateTransform x:Name="Rotate" />
                                    </controls:TouchToggleButton.RenderTransform>
                                    <controls:TouchToggleButton.Triggers>
                                        <EventTrigger RoutedEvent="ToggleButton.Checked">
                                            <EventTrigger.Actions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetName="Rotate" Storyboard.TargetProperty="Angle" Duration="00:00:0.2" To="360" />
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger.Actions>
                                        </EventTrigger>
                                        <EventTrigger RoutedEvent="ToggleButton.Unchecked">
                                            <EventTrigger.Actions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <DoubleAnimation Storyboard.TargetName="Rotate" Storyboard.TargetProperty="Angle" Duration="00:00:0.2" To="0" />
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger.Actions>
                                        </EventTrigger>
                                    </controls:TouchToggleButton.Triggers>
                                    <controls:TouchToggleButton.CheckedContent>
                                        <Grid>
                                            <controls:TouchIcon Icon="ChevronDown" Foreground="{StaticResource TangoExpanderIconForegroundBrush}" Width="12" Height="12" Background="Transparent" />
                                        </Grid>
                                    </controls:TouchToggleButton.CheckedContent>
                                    <Grid>
                                        <controls:TouchIcon Icon="ChevronUpSolid" Foreground="{StaticResource TangoExpanderIconForegroundBrush}" Width="12" Height="12" />
                                    </Grid>
                                </controls:TouchToggleButton>

                                <ToggleButton IsChecked="{Binding RelativeSource={RelativeSource AncestorType=controls:TouchExpander},Path=IsExpanded,Mode=TwoWay}">
                                    <ToggleButton.Template>
                                        <ControlTemplate TargetType="ToggleButton">
                                            <ContentPresenter/>
                                        </ControlTemplate>
                                    </ToggleButton.Template>
                                    <Border Background="Transparent">
                                        <ContentPresenter Content="{TemplateBinding Header}" />
                                    </Border>
                                </ToggleButton>
                            </DockPanel>

                            <Grid Grid.Row="1">
                                <Grid.Style>
                                    <Style TargetType="Grid">
                                        <Setter Property="LayoutTransform">
                                            <Setter.Value>
                                                <ScaleTransform x:Name="scaleTransform" ScaleX="1" ScaleY="0" />
                                            </Setter.Value>
                                        </Setter>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=controls:TouchExpander},Path=IsExpanded}" Value="True">
                                                <DataTrigger.EnterActions>
                                                    <BeginStoryboard>
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetProperty="(Grid.LayoutTransform).(ScaleTransform.ScaleY)" Duration="00:00:0.2" To="1" />
                                                        </Storyboard>
                                                    </BeginStoryboard>
                                                </DataTrigger.EnterActions>
                                                <DataTrigger.ExitActions>
                                                    <BeginStoryboard>
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetProperty="(Grid.LayoutTransform).(ScaleTransform.ScaleY)" Duration="00:00:0.2" To="0" />
                                                        </Storyboard>
                                                    </BeginStoryboard>
                                                </DataTrigger.ExitActions>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Grid.Style>
                                <ContentPresenter Content="{TemplateBinding Content}" />
                            </Grid>
                        </Grid>
                    </controls:TouchDropShadowBorder>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>