aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.xaml
blob: 62e9b215fb25b9558b31864b6230206bc96e5b57 (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
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                    xmlns:local="clr-namespace:Tango.Touch.Controls">

    <Style TargetType="{x:Type local:TouchStaticListBox}">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:TouchStaticListBox}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                        <ItemsControl ItemsSource="{TemplateBinding ItemsSource}" ItemsPanel="{TemplateBinding ItemsPanel}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <local:TouchStaticListBoxItem Style="{Binding RelativeSource={RelativeSource AncestorType=local:TouchStaticListBox},Path=ItemContainerStyle}">
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Loaded">
                                                <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=local:TouchStaticListBox},Path=ListBoxItemLoadedCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=local:TouchStaticListBoxItem}}" />
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                        <ContentControl Content="{Binding}" ContentTemplate="{Binding RelativeSource={RelativeSource AncestorType=local:TouchStaticListBox},Path=ItemTemplate}"></ContentControl>
                                    </local:TouchStaticListBoxItem>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>