Skip to content

Instantly share code, notes, and snippets.

@icebeam7
Created February 19, 2019 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icebeam7/88491bbadb163495bc702ee5902b32a0 to your computer and use it in GitHub Desktop.
Save icebeam7/88491bbadb163495bc702ee5902b32a0 to your computer and use it in GitHub Desktop.
WeatherBotv4App - BotView.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters="clr-namespace:WeatherBotv4App.Converters"
x:Class="WeatherBotv4App.Views.BotView">
<ContentPage.Resources>
<ResourceDictionary>
<converters:UserAlignmentConverter x:Key="userAlignmentConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout
Spacing="10"
Padding="10"
HorizontalOptions="Fill"
VerticalOptions="Fill"
Orientation="Vertical">
<ListView
ItemsSource="{Binding Messages}"
VerticalOptions="StartAndExpand"
HorizontalOptions="Fill"
HasUnevenRows="true">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout
Orientation="Vertical">
<Label
Text="{Binding Message.Text}"
FontSize="Large"
VerticalOptions="StartAndExpand"
HorizontalOptions="Fill"
HorizontalTextAlignment="{Binding Message.User, Converter={StaticResource userAlignmentConverter}}" />
<Label
Text="{Binding Message.User}"
FontSize="Small"
TextColor="Accent"
VerticalOptions="End"
HorizontalOptions="Fill"
HorizontalTextAlignment="{Binding Message.User, Converter={StaticResource userAlignmentConverter}}"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackLayout
Orientation="Horizontal"
HorizontalOptions="FillAndExpand">
<Entry
Text="{Binding Query, Mode=TwoWay}"
Placeholder="Write a message"
HorizontalTextAlignment="End"
Margin="10"
VerticalOptions="End"
HorizontalOptions="FillAndExpand"/>
<Button
Command="{Binding SendQueryCommand}"
Text="Send message"
WidthRequest="150"
Margin="10"/>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment