aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/TouchNativeListBox.xaml
blob: 456e82750ff5347536a211701605185d75997757 (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
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:components="clr-namespace:Tango.Touch.Components"
                    xmlns:local="clr-namespace:Tango.Touch.Controls">

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

    <Style x:Key="TangoTouchNativeListBoxItem" TargetType="ListBoxItem">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
        <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter>
        <Setter Property="Background" Value="Transparent"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <components:Ripple RippleBrush="{StaticResource TangoRippleDarkBrush}" RippleFactor="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNativeListBox},Path=RippleFactor}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
                        <components:Ripple.Style>
                            <Style TargetType="components:Ripple">
                                <Setter Property="Disabled" Value="False"></Setter>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:LightTouchScrollViewer},Path=IsScrolling}" Value="True">
                                        <Setter Property="Disabled" Value="True"></Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </components:Ripple.Style>
                        <Border Background="{TemplateBinding Background}">
                            <ContentControl Content="{Binding}" ContentTemplate="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNativeListBox},Path=ItemTemplate}" />
                        </Border>
                    </components:Ripple>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:TouchNativeListBox}">
        <Setter Property="ItemContainerStyle" Value="{StaticResource TangoTouchNativeListBoxItem}"></Setter>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TouchNativeListBox}">
                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="1" SnapsToDevicePixels="true">
                        <local:LightTouchScrollViewer x:Name="PART_ScrollViewer">
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </local:LightTouchScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>