add app list view

This commit is contained in:
jianxin committed 2024-08-28 22:17:27 +08:00
1 parent bbd208af43
commit ad1adbff15
3 files changed
+63 -2

No files matched your search

+27 -1
View File
@@ -4,9 +4,35 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="using:GZStudio.Views"
mc:Ignorable="d">
<Grid x:Name="ContentArea">
<Button x:Uid="AppList_Import" VerticalAlignment="Top" />
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<!-- Row for the Button -->
<RowDefinition Height="*"/>
<!-- Row for the ListView -->
</Grid.RowDefinitions>
<Button x:Uid="AppList_Import" VerticalAlignment="Top" Grid.Row="0" Margin="4,0,0,0" />
<ListView ItemsSource="{x:Bind AppListData}" Grid.Row="1">
<ListView.ItemTemplate>
<DataTemplate x:DataType="local:AppInfo">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<!-- A列 -->
<ColumnDefinition Width="*" />
<!-- B列 -->
</Grid.ColumnDefinitions>
<TextBlock Text="{x:Bind Name}" Grid.Column="0" Margin="5" />
<TextBlock Text="{x:Bind CreatedTime}" Grid.Column="1" Margin="5" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Page>
+36 -1
View File
@@ -1,9 +1,24 @@
using GZStudio.ViewModels;
using System.Collections.ObjectModel;
using GZStudio.ViewModels;
using Microsoft.UI.Xaml.Controls;
namespace GZStudio.Views;
public class AppInfo
{
public string? Name
{
get; set;
}
public string? CreatedTime
{
get; set;
}
}
public sealed partial class AppListPage : Page
{
public AppListViewModel ViewModel
@@ -15,5 +30,25 @@ public sealed partial class AppListPage : Page
{
ViewModel = App.GetService<AppListViewModel>();
InitializeComponent();
AppListData = new ObservableCollection<AppInfo>
{
new AppInfo { Name = "App A", CreatedTime = "2024-06-15" },
new AppInfo { Name = "App B", CreatedTime = "2024-08-30" },
new AppInfo { Name = "App C", CreatedTime = "2024-08-30" },
new AppInfo { Name = "App D", CreatedTime = "2024-08-30" },
new AppInfo { Name = "App E", CreatedTime = "2024-08-30" },
new AppInfo { Name = "App F", CreatedTime = "2024-08-30" },
new AppInfo { Name = "App G", CreatedTime = "2024-08-30" },
new AppInfo { Name = "App H", CreatedTime = "2024-08-30" },
new AppInfo { Name = "App I", CreatedTime = "2024-08-30" },
new AppInfo { Name = "App J", CreatedTime = "2024-08-30" },
};
DataContext = this;
}
public ObservableCollection<AppInfo> AppListData
{
get; set;
}
}
View File
Whitespace-only changes.