aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.xaml
blob: 15ea569a0e4318ad4777eb6876e453bf45ea5590 (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
<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 Source="../Resources/Colors.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <converters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter" />

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

                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="1*"/>
                            </Grid.RowDefinitions>

                            <ContentPresenter Grid.Row="1" Content="{TemplateBinding Content}" />

                            <Grid x:Name="PART_GridMask" Grid.RowSpan="2" Background="{StaticResource TangoNotificationBarMaskBrush}" Opacity="0" IsHitTestVisible="False">

                            </Grid>

                            <Grid x:Name="PART_Grid_Container" VerticalAlignment="Top" Background="Transparent" ClipToBounds="False">
                                <Canvas>
                                    <Border ClipToBounds="True" x:Name="PART_BorderDrag" VerticalAlignment="Top" Background="Transparent" Width="{Binding RelativeSource={RelativeSource AncestorType=Canvas},Path=ActualWidth}">
                                        <Border x:Name="PART_BorderNotifications" VerticalAlignment="Top" BorderBrush="{StaticResource TangoNotificationBarBottomBorderBrush}" Background="{StaticResource TangoNotificationBarBackgroundBrush}">
                                            <ItemsControl x:Name="PART_ItemsControl" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Notifications}">
                                                <ItemsControl.ItemTemplate>
                                                    <DataTemplate>
                                                        <Border Background="{StaticResource TangoNotificationBackgroundBrush}" BorderBrush="{StaticResource TangoNotificationBorderBrush}" BorderThickness="0 0 0 5">
                                                            <ContentControl Content="{Binding}" ContentTemplate="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=NotificationTemplate}"></ContentControl>
                                                        </Border>
                                                    </DataTemplate>
                                                </ItemsControl.ItemTemplate>
                                            </ItemsControl>
                                        </Border>
                                    </Border>

                                    <Grid x:Name="PART_NotificationCounterGrid" Canvas.Left="85" Canvas.Top="45" Width="32" Height="32" HorizontalAlignment="Left" VerticalAlignment="Bottom" IsHitTestVisible="False">
                                        <Grid>
                                            <Grid.Style>
                                                <Style TargetType="Grid">
                                                    <Setter Property="Visibility" Value="Collapsed"></Setter>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=Notifications.Count,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=1}" Value="True">
                                                            <Setter Property="Visibility" Value="Visible"></Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Grid.Style>
                                            <Ellipse Fill="White" StrokeThickness="1" Stroke="{StaticResource TangoPrimaryAccentBrush}">
                                            </Ellipse>
                                            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=Notifications.Count}"></TextBlock>
                                        </Grid>
                                    </Grid>
                                </Canvas>
                            </Grid>
                        </Grid>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>