MessageTextPage.xaml 13.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<!-- **********************************************************************
* Copyright (C) 2016 by Savoir-faire Linux                                *
* Author: Jäger Nicolas<nicolas.jager@savoirfairelinux.com>               *
* Author: Traczyk Andreas<andreas.traczyk@savoirfairelinux.com>           *
*                                                                         *
* This program is free software; you can redistribute it and/or modify    *
* it under the terms of the GNU General Public License as published by    *
* the Free Software Foundation; either version 3 of the License, or       *
* (at your option) any later version.                                     *
*                                                                         *
* This program is distributed in the hope that it will be useful,         *
* but WITHOUT ANY WARRANTY; without even the implied warranty of          *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
* GNU General Public License for more details.                            *
*                                                                         *
* You should have received a copy of the GNU General Public License       *
* along with this program.  If not, see <http://www.gnu.org/licenses/> .  *
*********************************************************************** -->
<Page
20 21 22 23
    x:Class="RingClientUWP.Views.MessageTextPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:RingClientUWP"
24
    xmlns:views="using:RingClientUWP.Views"
25 26 27
    xmlns:ctl="using:RingClientUWP.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
28
    NavigationCacheMode="Enabled"
29 30 31
    mc:Ignorable="d">

    <Page.Resources>
32 33 34 35 36
        <!-- bubble -->
        <views:BubbleBackground x:Key="_bubbleBackground_" />
        <views:BubbleHorizontalAlignement x:Key="_bubbleHorizontalAlignement_" />
        <DataTemplate x:Key="ConversationMessageTemplate"
                      x:DataType="local:ConversationMessage">
37
            <Grid Margin="6,0,12,0"
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
                  HorizontalAlignment="{x:Bind FromContact, Converter={StaticResource _bubbleHorizontalAlignement_}}" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*" />
                    <ColumnDefinition Width="8*" />
                </Grid.ColumnDefinitions>
                <Border  Background="{x:Bind FromContact, Converter={StaticResource _bubbleBackground_}}"
                         CornerRadius="10"
                         Grid.Column="1"
                         Width="auto"
                         Height="auto"
                         Padding="5"
                         Margin="5" >
                    <ContentPresenter>
                        <!--Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."-->
                        <TextBlock x:Name="_msgContent_"
                                   TextWrapping="Wrap"
54
                                   IsTextSelectionEnabled="True"
55 56 57 58
                                   Text="{x:Bind Payload}"
                                   Foreground="White"/>
                    </ContentPresenter>
                </Border>
59
            </Grid>
60
        </DataTemplate>
61
        <!-- barre d'envoi de message -->
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
        <Style TargetType="TextBox">
            <Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}" />
            <Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}" />
            <Setter Property="Foreground" Value="Black" />
            <Setter Property="Background" Value="white" />
            <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
            <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
            <Setter Property="ScrollViewer.HorizontalScrollMode" Value="Auto" />
            <Setter Property="ScrollViewer.VerticalScrollMode" Value="Auto" />
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
            <Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
            <Setter Property="Padding" Value="4,4"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="TextBox">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Border x:Name="BackgroundElement"
                                    Grid.Row="1"
                                    Background="{TemplateBinding Background}"
                                    Margin="{TemplateBinding BorderThickness}"
                                    Opacity="1"
                                    Grid.ColumnSpan="2"
93
                                    BorderBrush="#3bc1d3"
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
                                    BorderThickness="1"
                                    Grid.RowSpan="1"/>
                            <ScrollViewer x:Name="ContentElement"
                                          Grid.Row="1"
                                          HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
                                          HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                          VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
                                          VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                          IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
                                          IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
                                          IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
                                          Margin="{TemplateBinding BorderThickness}"
                                          Padding="{TemplateBinding Padding}"
                                          IsTabStop="False"
                                          AutomationProperties.AccessibilityView="Raw"
                                          ZoomMode="Disabled" />
110

111 112 113 114
                            <Button x:Name="_sendBtn_"
                                    Background="Transparent"
                                    Grid.Row="1"
                                    FontFamily="Segoe MDL2 Assets"
115
                                    Foreground="#3bc1d3"
116 117 118 119 120 121 122 123 124 125 126 127 128
                                    Content="&#xE122;"
                                    IsTabStop="False"
                                    Grid.Column="1"
                                    Click="_sendBtn__Click"
                                    Visibility="Visible"
                                    MinWidth="34"
                                    FontSize="20"
                                    VerticalAlignment="Stretch"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
129 130 131 132 133 134
        <DataTemplate x:Key="_AssociableAccountsListDataTemplate_"
                      x:DataType="local:Account">
            <Grid>
                <TextBlock Text="{x:Bind name_}"/>
            </Grid>
        </DataTemplate>
135 136
    </Page.Resources>

137
    <Grid Background="#FFF2F2F2">
138
        <Grid.RowDefinitions>
139
            <RowDefinition Height="90" />
140 141 142
            <RowDefinition Height="*"/>
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
143
        <Grid Grid.Row="0"
144
                    Background="White"
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
                    Height="90">
            <Grid.RowDefinitions>
                <RowDefinition Height="60" />
                <RowDefinition Height="30" />
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="60"/>
                    <ColumnDefinition Width="280"/>
                    <ColumnDefinition Width="140"/>
                </Grid.ColumnDefinitions>
                <Ellipse Grid.Column="0"
                         Width="50"
                         Height="50">
                    <Ellipse.Fill>
                        <ImageBrush x:Name="_contactBarAvatar_"
                                ImageSource="ms-appx:///Assets/TESTS/contactAvatar.png"/>
                    </Ellipse.Fill>
                </Ellipse>
                <TextBlock  x:Name="_title_"
165
                            Grid.Column="1"
166 167 168 169 170 171 172
                            Text="[TEXT MISSING]"
                            TextWrapping="NoWrap"
                            TextTrimming="CharacterEllipsis"
                            VerticalAlignment="Center"
                            FontSize="18"
                            Margin="6" />
                <ComboBox   x:Name="_associableAccountsList_"
173
                            Grid.Column="2"
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
                            Margin="6,14,6,6"
                            Visibility="Collapsed">
                    <ComboBox.ItemTemplate>
                        <DataTemplate x:DataType="local:Account">
                            <TextBlock Text="{x:Bind name_, Mode=OneWay}" />
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
            </Grid>
            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Button x:Name="_videoCall_"
                    Click="_videoCall__Click"
                    Grid.Column="0"
                    Content="&#xE714;"
                    FontFamily="Segoe MDL2 Assets"
                    FontSize="14"
                    Style="{StaticResource ButtonStyle4}"
                    Margin="6,2,6,6"/>
                <Button x:Name="_audioCall_"
                    Grid.Column="1"
                    Click="_audioCall__Click"
                    Content="&#xE13A;"
                    FontSize="14"
                    FontFamily="Segoe MDL2 Assets"
                    Style="{StaticResource ButtonStyle4}"
                    Margin="6,2,6,6"/>
                <Button x:Name="_clearConversation_"
                    Grid.Column="2"
                    Click="_clearConversation__Click"
                    Content="&#xE894;"
                    FontFamily="Segoe MDL2 Assets"
                    FontSize="14"
                    Style="{StaticResource ButtonStyle4}"
                    Margin="6,2,6,6"/>
                <Button x:Name="_deleteContact_"
                    Grid.Column="3"
                    Click="_deleteContact__Click"
                    Content="&#xE74D;"
                    FontFamily="Segoe MDL2 Assets"
                    FontSize="14"
                    Style="{StaticResource ButtonStyle4}"
                    Margin="6,2,6,6"/>
            </Grid>
        </Grid>
224
        <ScrollViewer x:Name="_scrollView_"
225 226 227 228
                       BorderThickness="0,0,0,0"
                       BorderBrush="#3bc1d3"
                       Grid.Row="1"
                       ScrollViewer.VerticalScrollBarVisibility="Auto">
229 230 231 232 233 234 235
            <StackPanel>
                <ListBox x:Name="_messagesList_"
                         Margin="0"
                         Padding="0"
                         ItemContainerStyle="{StaticResource messageBubleStyle}"
                         ItemTemplate="{StaticResource ConversationMessageTemplate}">
                </ListBox>
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
            </StackPanel>
        </ScrollViewer>
        <Grid Height="50"
              Grid.Row="2"
              Margin="0"
              Padding="0"
              Background="#FFF2F2F2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <TextBox x:Name="_messageTextBox_"
                     HorizontalAlignment="Stretch"
                     TextWrapping="NoWrap"
                     VerticalAlignment="Center"
                     Margin="10"
                     Background="White"
                     KeyDown="_messageTextBox__KeyDown"/>
        </Grid>
    </Grid>
</Page>