parent
fe03da6100
commit
ee22a4de50
@ -0,0 +1,26 @@ |
|||||||
|
<?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.AddPartPage" |
||||||
|
xmlns:viewmodel="clr-namespace:UseRestService.ViewModels" |
||||||
|
x:DataType="viewmodel:AddPartViewModel" |
||||||
|
Title="Edit Part"> |
||||||
|
|
||||||
|
<Grid RowDefinitions="*,Auto" ColumnDefinitions="*,*,*" ColumnSpacing="5" Padding="10"> |
||||||
|
<TableView Intent="Data" Grid.Row="0" Grid.ColumnSpan="3"> |
||||||
|
<TableRoot> |
||||||
|
<TableSection Title="Part Info"> |
||||||
|
<EntryCell Label="Part ID" Text="{Binding PartID}" IsEnabled="False" /> |
||||||
|
<EntryCell Label="Part Name" Text="{Binding PartName}" /> |
||||||
|
<EntryCell Label="Part Type" Text="{Binding PartType}" /> |
||||||
|
<EntryCell Label="Supplier" Text="{Binding Suppliers}" /> |
||||||
|
</TableSection> |
||||||
|
</TableRoot> |
||||||
|
</TableView> |
||||||
|
|
||||||
|
<Button Text="Save" Grid.Row="1" Grid.Column="0" Command="{Binding SaveDataCommand}" Margin="20,0"/> |
||||||
|
<Button Text="Delete" Grid.Row="1" Grid.Column="1" Command="{Binding DeletePartCommand}"/> |
||||||
|
<Button Text="Cancel" Grid.Row="1" Grid.Column="2" Command="{Binding DoneEditingCommand}" Margin="20,0"/> |
||||||
|
</Grid> |
||||||
|
|
||||||
|
</ContentPage> |
@ -0,0 +1,35 @@ |
|||||||
|
using UseRestService.Data; |
||||||
|
using UseRestService.ViewModels; |
||||||
|
|
||||||
|
namespace UseRestService.Pages; |
||||||
|
|
||||||
|
[QueryProperty("PartToDisplay", "part")] |
||||||
|
public partial class AddPartPage : ContentPage |
||||||
|
{ |
||||||
|
AddPartViewModel viewModel; |
||||||
|
public AddPartPage() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
|
||||||
|
viewModel = new AddPartViewModel(); |
||||||
|
BindingContext = viewModel; |
||||||
|
} |
||||||
|
|
||||||
|
Part _partToDisplay; |
||||||
|
public Part PartToDisplay |
||||||
|
{ |
||||||
|
get => _partToDisplay; |
||||||
|
set |
||||||
|
{ |
||||||
|
if (_partToDisplay == value) |
||||||
|
return; |
||||||
|
|
||||||
|
_partToDisplay = value; |
||||||
|
|
||||||
|
viewModel.PartID = _partToDisplay.PartID; |
||||||
|
viewModel.PartName = _partToDisplay.PartName; |
||||||
|
viewModel.Suppliers = _partToDisplay.SupplierString; |
||||||
|
viewModel.PartType = _partToDisplay.PartType; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue