UI/SelectionBox.xaml
author Dean
Fri, 07 Oct 2016 16:59:59 +0200
changeset 1355 90a010abcd47
parent 1146 e436905d2d41
child 1536 3f483ab32648
permissions -rw-r--r--
Increase width of 'handshake' button so it doesn't change for English text.
Dean@1069
     1
<UserControl x:Class="pEp.UI.SelectionBox"
Dean@1069
     2
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Dean@1069
     3
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Dean@1069
     4
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Dean@1069
     5
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Dean@1072
     6
             xmlns:local="clr-namespace:pEp.UI"
Dean@1069
     7
             mc:Ignorable="d"
Dean@1069
     8
             d:DesignHeight="100"
Dean@1069
     9
             d:DesignWidth="150">
Dean@1069
    10
    <UserControl.Resources>
Dean@1105
    11
        <ResourceDictionary>
Dean@1105
    12
            <BooleanToVisibilityConverter x:Key="BoolToVisibility" />
Dean@1105
    13
            <ResourceDictionary.MergedDictionaries>
Dean@1105
    14
                <ResourceDictionary Source="pack://application:,,,/pEp;component/Resources/Dictionary.xaml" />
Dean@1105
    15
            </ResourceDictionary.MergedDictionaries>
Dean@1105
    16
        </ResourceDictionary>
Dean@1069
    17
    </UserControl.Resources>
Dean@1069
    18
    <Grid>
Dean@1069
    19
        <ListBox Name="ListBoxItems"
Dean@1069
    20
                 HorizontalContentAlignment="Stretch"
Dean@1072
    21
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Dean@1072
    22
                 ItemsSource="{Binding Items, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:SelectionBox}}}"
Dean@1072
    23
                 SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:SelectionBox}}}"
Dean@1072
    24
                 SelectedItem="{Binding SelectedItem, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:SelectionBox}}}">
Dean@1069
    25
            <ListBox.ItemTemplate>
Dean@1069
    26
                <DataTemplate>
Dean@1069
    27
                    <Grid HorizontalAlignment="Stretch"
Dean@1069
    28
                          VerticalAlignment="Stretch">
Dean@1069
    29
                        <Grid.ColumnDefinitions>
Dean@1069
    30
                            <ColumnDefinition Width="Auto" />
Dean@1069
    31
                            <ColumnDefinition Width="*" />
Dean@1069
    32
                            <ColumnDefinition Width="Auto" />
Dean@1069
    33
                        </Grid.ColumnDefinitions>
Dean@1069
    34
                        <Grid.RowDefinitions>
Dean@1072
    35
                            <RowDefinition Height="Auto"
Dean@1072
    36
                                           MinHeight="34" />
Dean@1069
    37
                            <RowDefinition Height="Auto" />
Dean@1069
    38
                            <RowDefinition Height="Auto" />
Dean@1069
    39
                        </Grid.RowDefinitions>
Dean@1069
    40
Dean@1069
    41
                        <!-- Main row of data -->
Dean@1069
    42
                        <Image Grid.Column="0"
Dean@1069
    43
                               Grid.Row="0"
Dean@1069
    44
                               Source="{Binding ItemImage}" />
Dean@1069
    45
                        <StackPanel Grid.Column="1"
Dean@1069
    46
                                    Grid.Row="0"
Dean@1069
    47
                                    Orientation="Vertical"
Dean@1069
    48
                                    HorizontalAlignment="Left"
Dean@1069
    49
                                    VerticalAlignment="Center"
Dean@1072
    50
                                    Margin="5,0,5,0">
Dean@1069
    51
                            <TextBlock Text="{Binding TextLine1}" />
Dean@1069
    52
                            <TextBlock Text="{Binding TextLine2}"
Dean@1072
    53
                                       Visibility="{Binding Path=IsTwoTextLinesVisible, Converter={StaticResource BoolToVisibility}, FallbackValue=Collapsed}" />
Dean@1069
    54
                        </StackPanel>
Dean@1069
    55
                        <Button Grid.Column="2"
Dean@1069
    56
                                Grid.Row="0"
Dean@1069
    57
                                Content="{Binding TextButton}"
Dean@1146
    58
                                Padding="{StaticResource ButtonPaddingStandard}"
Dean@1069
    59
                                MinHeight="32"
Dean@1355
    60
                                MinWidth="95"
Dean@1069
    61
                                HorizontalAlignment="Center"
Dean@1069
    62
                                VerticalAlignment="Center"
Dean@1069
    63
                                Tag="{Binding ButtonOnClick}"
Dean@1069
    64
                                Visibility="{Binding Path=IsButtonVisible, Converter={StaticResource BoolToVisibility}, FallbackValue=Collapsed}"
Dean@1069
    65
                                Click="Button_Click" />
Dean@1069
    66
Dean@1069
    67
                        <!-- Separator -->
Dean@1069
    68
                        <Separator Grid.Column="0"
Dean@1069
    69
                                   Grid.ColumnSpan="3"
Dean@1069
    70
                                   Grid.Row="1"
Dean@1069
    71
                                   Margin="0,3,0,3"
Dean@1069
    72
                                   Visibility="{Binding Path=IsExpanded, Converter={StaticResource BoolToVisibility}, FallbackValue=Collapsed}" />
Dean@1069
    73
Dean@1069
    74
                        <!-- Extended data only visible during selection -->
Dean@1069
    75
                        <Grid Grid.Column="0"
Dean@1069
    76
                              Grid.ColumnSpan="3"
Dean@1069
    77
                              Grid.Row="2"
Dean@1069
    78
                              Visibility="{Binding Path=IsExpanded, Converter={StaticResource BoolToVisibility}, FallbackValue=Collapsed}">
Dean@1069
    79
                            <Grid.RowDefinitions>
Dean@1069
    80
                                <RowDefinition Height="Auto" />
Dean@1069
    81
                                <RowDefinition Height="Auto" />
Dean@1069
    82
                            </Grid.RowDefinitions>
Dean@1069
    83
Dean@1069
    84
                            <!-- Expanded Text -->
Dean@1069
    85
                            <TextBlock Grid.Row="0"
Dean@1069
    86
                                       Text="{Binding ExpandedText}"
Dean@1069
    87
                                       TextAlignment="Left"
Dean@1069
    88
                                       TextWrapping="Wrap"
Dean@1069
    89
                                       HorizontalAlignment="Stretch"
Dean@1069
    90
                                       VerticalAlignment="Stretch" />
Dean@1069
    91
Dean@1069
    92
                            <!-- Expanded Buttons -->
Dean@1069
    93
                            <StackPanel Grid.Row="1"
Dean@1069
    94
                                        Orientation="Horizontal"
Dean@1069
    95
                                        Margin="0,3,0,0"
Dean@1069
    96
                                        HorizontalAlignment="Center">
Dean@1069
    97
                                <Button Content="{Binding ExpandedButton1Text}"
Dean@1074
    98
                                        Style="{Binding ExpandedButton1Style}"
Dean@1069
    99
                                        Tag="{Binding ExpandedButton1OnClick}"
Dean@1069
   100
                                        Click="Button_Click" />
Dean@1069
   101
                                <Button Content="{Binding ExpandedButton2Text}"
Dean@1074
   102
                                        Style="{Binding ExpandedButton2Style}"
Dean@1069
   103
                                        Tag="{Binding ExpandedButton2OnClick}"
Dean@1105
   104
                                        Click="Button_Click">
Dean@1105
   105
                                    <Button.Margin>
Dean@1105
   106
                                        <Thickness Bottom="0"
Dean@1105
   107
                                                   Left="{StaticResource ButtonSpacingStandard}"
Dean@1105
   108
                                                   Right="0"
Dean@1105
   109
                                                   Top="0" />
Dean@1105
   110
                                    </Button.Margin>
Dean@1105
   111
                                </Button>
Dean@1069
   112
                                <Button Content="{Binding ExpandedButton3Text}"
Dean@1074
   113
                                        Style="{Binding ExpandedButton3Style}"
Dean@1069
   114
                                        Tag="{Binding ExpandedButton3OnClick}"
Dean@1105
   115
                                        Click="Button_Click">
Dean@1105
   116
                                    <Button.Margin>
Dean@1105
   117
                                        <Thickness Bottom="0"
Dean@1105
   118
                                                   Left="{StaticResource ButtonSpacingStandard}"
Dean@1105
   119
                                                   Right="0"
Dean@1105
   120
                                                   Top="0" />
Dean@1105
   121
                                    </Button.Margin>
Dean@1105
   122
                                </Button>
Dean@1069
   123
                            </StackPanel>
Dean@1069
   124
                        </Grid>
Dean@1069
   125
                    </Grid>
Dean@1069
   126
                </DataTemplate>
Dean@1069
   127
            </ListBox.ItemTemplate>
Dean@1069
   128
            <ListBox.Items>
Dean@1069
   129
            </ListBox.Items>
Dean@1069
   130
        </ListBox>
Dean@1069
   131
    </Grid>
Dean@1069
   132
</UserControl>