yavsc/ZicMoove/ZicMoove/Views/UserListView.xaml

64 lines
2.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ZicMoove.Views.UserListView"
xmlns:local="clr-namespace:ZicMoove;assembly=ZicMoove"
xmlns:extensions="clr-namespace:ZicMoove.Extensions;assembly=ZicMoove"
xmlns:converters="clr-namespace:ZicMoove.Converters;assembly=ZicMoove"
>
<ContentView.Resources>
<ResourceDictionary>
<Style TargetType="Label">
<Setter Property="Style" Value="{StaticResource ContentLabelStyle}" />
</Style>
<Style TargetType="Button">
<Setter Property="Style" Value="{StaticResource ButtonStyle}" />
</Style>
<converters:BooleanToObjectConverter x:Key="cxtdToBck" x:TypeArguments="Style">
<converters:BooleanToObjectConverter.FalseObject>
<Style TargetType="StackLayout">
<Setter Property="BackgroundColor" Value="{StaticResource DisconnectedUserBgColor}" />
</Style>
</converters:BooleanToObjectConverter.FalseObject>
<converters:BooleanToObjectConverter.TrueObject>
<Style TargetType="StackLayout">
<Setter Property="BackgroundColor" Value="{StaticResource ConnectedUserBgColor}" />
</Style>
</converters:BooleanToObjectConverter.TrueObject>
</converters:BooleanToObjectConverter>
</ResourceDictionary>
</ContentView.Resources>
<ContentView.Content>
<ListView x:Name="list" IsPullToRefreshEnabled="True"
HasUnevenRows="true" RowHeight="80" ItemsSource="{Binding .}"
SeparatorVisibility="Default" SeparatorColor="Black">
<ListView.ItemTemplate HeightRequest="80" VerticalOptions="StartAndExpand" >
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout
Orientation="Horizontal" Padding="3,3,3,3" VerticalOptions="StartAndExpand">
<StackLayout Orientation="Horizontal" Padding="5,5,5,5"
Style="{Binding IsConnected, Converter={StaticResource cxtdToBck}}" >
<Image Source="{Binding AvatarSource}" Aspect="AspectFit" />
<Image Source="{Binding MessagesBadge}" Aspect="AspectFit" />
<Label Text="{Binding UserName}" />
</StackLayout>
<Label Text="{Binding RolesAsAString}" TextColor="{StaticResource QuietTextColor}"
FontSize="{StaticResource SmallFontSize}" />
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentView.Content>
</ContentView>