-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathBlogsPage.xaml
40 lines (38 loc) · 3.03 KB
/
BlogsPage.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:dx="http://schemas.devexpress.com/maui"
xmlns:viewModels="clr-namespace:BlazorDemo.MAUI.ViewModels"
x:Class="BlazorDemo.MAUI.MauiViews.BlogsPage">
<ContentPage.BindingContext>
<viewModels:BlogsViewModel/>
</ContentPage.BindingContext>
<Grid>
<dx:DXCollectionView ItemsSource="{Binding Blogs}" IsRefreshing="{Binding IsLoading, Mode=TwoWay}" IsLoadMoreEnabled="True" LoadMoreCommand="{Binding LoadMoreCommand}" TapCommand="{Binding OpenBlogCommand}">
<dx:DXCollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type viewModels:BlogPost}">
<VerticalStackLayout Margin="0,8,0,8">
<Border StrokeShape="RoundRectangle 20,20,20,20" Margin="16,0,16,10">
<Image Source="{Binding ImagePath}" Aspect="AspectFill" HeightRequest="200"/>
</Border>
<Label Text="{Binding Title}" TextColor="{AppThemeBinding Light={StaticResource Gray600}, Dark={StaticResource Gray100}}" FontSize="18" MaxLines="3" LineBreakMode="WordWrap" Margin="16,0,16,10"/>
<Grid ColumnDefinitions="Auto,Auto,*,Auto" Margin="16,0,16,0">
<Image Source="{Binding AvatarPath}" WidthRequest="24" HeightRequest="24">
<Image.Clip>
<EllipseGeometry RadiusX="12" RadiusY="12" Center="12,12"/>
</Image.Clip>
</Image>
<Label Text="{Binding AuthorName}" VerticalOptions="Center" TextColor="{AppThemeBinding Light={StaticResource Gray600}, Dark={StaticResource Gray300}}" Margin="5,0,0,0" Grid.Column="1"/>
<Label Text="{Binding PublicationDate, StringFormat=' • {0:m}'}" TextColor="{AppThemeBinding Light={StaticResource Gray600}, Dark={StaticResource Gray300}}" VerticalOptions="Center" Grid.Column="2"/>
<dx:DXButton BackgroundColor="Transparent" Grid.Column="3" Margin="10,0,0,0" Padding="4,0,4,0" WidthRequest="28" VerticalOptions="Center"
CommandParameter="{Binding}"
Command="{Binding Source={RelativeSource Mode=FindAncestorBindingContext, AncestorType={x:Type viewModels:BlogsViewModel}}, Path=ShareCommand}">
<Image Source="share" HeightRequest="20"/>
</dx:DXButton>
</Grid>
<Border BackgroundColor="{AppThemeBinding Light={StaticResource Gray100}, Dark={StaticResource Gray900}}" HeightRequest="2" StrokeThickness="0" Margin="0,10,0,0"/>
</VerticalStackLayout>
</DataTemplate>
</dx:DXCollectionView.ItemTemplate>
</dx:DXCollectionView>
</Grid>
</ContentPage>