aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/TouchListBox.xaml
blob: 61342fc0bc2a8f91e10753f84e6357cc3691c3eb (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
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; fo
<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:i="http://schemas.microsoft.com/expression/2010/interactivity"
                    xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
                    xmlns:localConverters="clr-namespace:Tango.Touch.Converters"
                    xmlns:local="clr-namespace:Tango.Touch.Controls">

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

        <ResourceDictionary>
            <localConverters:SelectionModesToBooleanConverter x:Key="SelectionModesToBooleanConverter" />
        </ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type local:TouchListBox}">
        <Setter Property="local:TouchPanel.PreventFocusSteal" Value="True"></Setter>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="local:TouchListBoxItem">
                    <Setter Property="Background" Value="Transparent"></Setter>
                    <Style.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}" Value="True" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchListBox},Path=SelectionMode,Converter={StaticResource SelectionModesToBooleanConverter},ConverterParameter='Single,Multiple'}" Value="True" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Background" Value="{StaticResource TangoLightSelectedBrush}"></Setter>
                        </MultiDataTrigger>
                    </Style.Triggers>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TouchListBox}">
                    <Border  BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                        <local:LightTouchScrollViewer x:Name="PART_ScrollViewer" ScrollBarVisibility="{TemplateBinding ScrollBarVisibility}" DisableScrolling="{TemplateBinding DisableScrolling}">
                            <ItemsControl VirtualizingPanel.IsVirtualizing="False" x:Name="PART_ItemsControl" Style="{x:Null}" ItemsSource="{TemplateBinding ItemsSource}" VerticalAlignment="Top" ClipToBounds="True">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel  Orientation="Vertical" VerticalAlignment="Top" />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                                <ItemsControl.ItemTemplate>
                                    <DataTemplate>
                                        <local:TouchListBoxItem Style="{Binding RelativeSource={RelativeSource AncestorType=local:TouchListBox},Path=ItemContainerStyle}">
                                            <i:Interaction.Triggers>
                                                <i:EventTrigger EventName="Loaded">
                                                    <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=local:TouchListBox},Path=ListBoxItemLoadedCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=local:TouchListBoxItem}}" />
                                                </i:EventTrigger>
                                            </i:Interaction.Triggers>
                                            <components:Ripple RippleBrush="{StaticResource TangoRippleDarkBrush}" RippleFactor="30">
                                                <components:Ripple.Style>
                                                    <Style TargetType="components:Ripple">
                                                        <Setter Property="Disabled" Value="False"></Setter>
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchListBox},Path=ScrollViewer.IsScrolling}" Value="True">
                                                                <Setter Property="Disabled" Value="True"></Setter>
                                                            </DataTrigger>
                                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchListBox},Path=IsMultiSelecting}" Value="True">
                                                                <Setter Property="Disabled" Value="True"></Setter>
                                                            </DataTrigger>
                                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchListBox},Path=DisableRipple}" Value="True">
                                                                <Setter Property="Disabled" Value="True"></Setter>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </components:Ripple.Style>
                                                <ContentControl Content="{Binding}" ContentTemplate="{Binding RelativeSource={RelativeSource AncestorType=local:TouchListBox},Path=ItemTemplate}" />
                                            </components:Ripple>
                                        </local:TouchListBoxItem>
                                    </DataTemplate>
                                </ItemsControl.ItemTemplate>
                            </ItemsControl>
                        </local:LightTouchScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>