maui-linux/Xamarin.Forms.Controls/HanselForms/TwitterPage.xaml

44 строки
2.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Forms.Controls.TwitterPage" Title="{Binding Title}" Icon="{Binding Icon}" IsBusy="{Binding IsBusy}">
<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<ListView CachingStrategy="RecycleElement" x:Name="listView" ItemsSource="{Binding Tweets}" HasUnevenRows="True" RowHeight="150" IsPullToRefreshEnabled="True" RefreshCommand="{Binding LoadTweetsCommand}" IsRefreshing="{Binding IsBusy, Mode=OneWay}" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="10,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image Source="{Binding Image}" VerticalOptions="Center">
<Image.WidthRequest>
<OnPlatform x:TypeArguments="x:Double">
<OnPlatform.iOS>55</OnPlatform.iOS>
<OnPlatform.Android>55 </OnPlatform.Android>
<OnPlatform.WinPhone>75</OnPlatform.WinPhone>
</OnPlatform>
</Image.WidthRequest>
<Image.HeightRequest>
<OnPlatform x:TypeArguments="x:Double">
<OnPlatform.iOS>55</OnPlatform.iOS>
<OnPlatform.Android>55</OnPlatform.Android>
<OnPlatform.WinPhone>75</OnPlatform.WinPhone>
</OnPlatform>
</Image.HeightRequest>
</Image>
<StackLayout Grid.Column="1" Padding="8" Spacing="4" VerticalOptions="Center">
<Label Text="{Binding Date}" FontSize="Medium" TextColor="#3498DB" LineBreakMode="NoWrap" />
<Label Text="{Binding Text}" x:Name="TweetText" FontSize="Small" LineBreakMode="WordWrap" />
</StackLayout>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackLayout IsVisible="{Binding IsBusy}" BackgroundColor="#80000000" Padding="12" AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5,0.5,-1,-1">
<ActivityIndicator IsRunning="{Binding IsBusy}" Color="White">
</ActivityIndicator>
<Label Text="Loading Twitter..." HorizontalOptions="Center" TextColor="White" />
</StackLayout>
</AbsoluteLayout>
</ContentPage>