aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/TouchSideMenu.xaml
blob: 309a317b9afa5975eb6b66e63258cbe4af7c0610 (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
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
                    xmlns:local="clr-namespace:Tango.Touch.Controls">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary>
            <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        </ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type local:TouchSideMenu}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TouchSideMenu}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">

                        <Grid>
                            
                            <!--Main Content-->
                            <ContentControl Content="{TemplateBinding Content}"/>

                            <!--Menu Opened Mask-->
                            <Border Background="#83000000" IsHitTestVisible="True" Visibility="{TemplateBinding IsOpened,Converter={StaticResource BooleanToVisibilityConverter}}">
                                <ToggleButton Style="{x:Null}" Opacity="0" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsOpened}" />
                            </Border>

                            <!--Menu Content-->
                            <ContentControl Content="{TemplateBinding MenuContent}" HorizontalAlignment="Left">
                                <ContentControl.Style>
                                    <Style TargetType="ContentControl">
                                        <Setter Property="RenderTransform">
                                            <Setter.Value>
                                                <ScaleTransform ScaleY="1" ScaleX="0"></ScaleTransform>
                                            </Setter.Value>
                                        </Setter>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsOpened}" Value="True">
                                                <DataTrigger.EnterActions>
                                                    <BeginStoryboard>
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.2" />
                                                        </Storyboard>
                                                    </BeginStoryboard>
                                                </DataTrigger.EnterActions>
                                                <DataTrigger.ExitActions>
                                                    <BeginStoryboard>
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="0" Duration="00:00:0.2" />
                                                        </Storyboard>
                                                    </BeginStoryboard>
                                                </DataTrigger.ExitActions>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </ContentControl.Style>
                            </ContentControl>
                        </Grid>
                        
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>