You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

34 lines
2.0 KiB

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="UseRestService.Pages.PartsPage"
Title="Part List"
xmlns:viewModel="clr-namespace:UseRestService.ViewModels"
xmlns:data="clr-namespace:UseRestService.Data"
x:DataType="viewModel:PartsViewModel">
<Grid RowDefinitions="Auto,*" ColumnDefinitions="*">
<Button Grid.Row="0" Grid.Column="0" Text="Add New Part" Margin="20, 10, 20, 10" Command="{Binding AddNewPartCommand}"/>
<RefreshView Grid.Row="1" Grid.Column="0" IsRefreshing="{Binding IsRefreshing}" x:Name="refreshView"
Command="{Binding LoadDataCommand}">
<CollectionView Margin="30,20,30,30"
ItemsSource="{Binding Parts}"
SelectedItem="{Binding SelectedPart, Mode=TwoWay}"
SelectionChangedCommand="{Binding PartSelectedCommand}"
SelectionMode="Single">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Vertical" ItemSpacing="20" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="data:Part">
<VerticalStackLayout Padding="15,10" Margin="10,5,10,5">
<Label Text="{Binding PartID, StringFormat='ID: {0}'}" FontSize="Title" Margin="0,0,0,20"/>
<Label Text="{Binding PartName, StringFormat='Part Name: {0}'}"/>
<Label Text="{Binding PartType, StringFormat='Part Type: {0}'}"/>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
</Grid>
</ContentPage>