Listviews of Products and users

This commit is contained in:
2025-08-21 17:18:35 +02:00
parent 1649eaa992
commit 543b9c2aaf
13 changed files with 358 additions and 41 deletions

View File

@ -4,8 +4,8 @@
x:Class="AdventureWorks.MAUI.Views.UserDetailView"
xmlns:partial="clr-namespace:AdventureWorks.MAUI.ViewsPartial"
xmlns:converters="clr-namespace:AdventureWorks.MAUI.Converters"
xmlns:vm="clr-namespace:AdventureWorks.ViewModelLayer;assembly=AdventureWorks.ViewModelLayer"
x:DataType="vm:UserViewModel"
xmlns:vm="clr-namespace:AdventureWorks.MAUI.CommandClasses"
x:DataType="vm:UserViewModelCommands"
Title="User Information">
<ContentPage.Resources>
@ -53,18 +53,20 @@
Text="First Name" />
<Entry Grid.Row="2"
Grid.Column="1"
Text="{Binding UserObject.FirstName}"/>
Text="{Binding UserObject.FirstName}" />
<Label Grid.Row="3"
Text="Last Name" />
<Entry Grid.Row="3"
Grid.Column="1"
Text="{Binding UserObject.LastName}"/>
Text="{Binding UserObject.LastName}" />
<Label Grid.Row="4"
Text="Email Address" />
<Entry Grid.Row="4"
Grid.Column="1"
Text="{Binding UserObject.Email}"/>
<Label Grid.Row="5" Text="Is Enrolled ?"/>
Text="{Binding UserObject.Email}" />
<Label Grid.Row="5"
Text="Is Enrolled?" />
<FlexLayout Grid.Row="5"
Grid.Column="1"
@ -89,50 +91,51 @@
</FlexLayout>
<Label Grid.Row="6"
Text="Still Employed"/>
Text="Still Employed" />
<Switch Grid.Row="6"
Grid.Column="1"
IsToggled="{Binding UserObject.IsActive}"/>
<Label Text="Employee Type"
Grid.Row="7"/>
Grid.Row="7" />
<FlexLayout Grid.Row="7"
Grid.Column="1"
Wrap="Wrap"
Direction="Row">
<HorizontalStackLayout>
<Label Text="Full-Time"/>
<Label Text="Full-Time" />
<RadioButton x:Name="FullTime"
IsChecked="{Binding UserObject.IsFullTime}"
GroupName="EmployeeType"/>
GroupName="EmployeeType" />
</HorizontalStackLayout>
<HorizontalStackLayout>
<Label Text="Part-Time"/>
<RadioButton GroupName="EmployeeType" IsChecked="{Binding UserObject.IsFullTime, Converter={StaticResource invertedBoolean}}"/>
<Label Text="Part-Time" />
<RadioButton IsChecked="{Binding UserObject.IsFullTime, Converter={StaticResource invertedBoolean}}"
GroupName="EmployeeType" />
</HorizontalStackLayout>
</FlexLayout>
<Label Text="Birth Date"
Grid.Row="8"/>
Grid.Row="8" />
<DatePicker Grid.Row="8"
Grid.Column="1"
Date="{Binding UserObject.BirthDate}"
HorizontalOptions="Start"/>
HorizontalOptions="Start" />
<Label Text="Start Time"
Grid.Row="9"/>
Grid.Row="9" />
<TimePicker Grid.Row="9"
Grid.Column="1"
Time="{Binding UserObject.StartTime}"
IsEnabled="{Binding UserObject.IsFullTime, Converter={StaticResource invertedBoolean}}"/>
<Label Text="Phone"
Grid.Row="10"/>
Grid.Row="10" />
<FlexLayout Grid.Row="10"
Grid.Column="1"
Wrap="Wrap"
Direction="Row">
<HorizontalStackLayout>
<Entry MinimumWidthRequest="120"
Text="{Binding UserObject.Phone}"/>
Text="{Binding UserObject.Phone}" />
</HorizontalStackLayout>
<HorizontalStackLayout>
<Picker ItemsSource="{Binding PhoneTypesList}"
@ -146,7 +149,8 @@
<HorizontalStackLayout Grid.Row="12"
Grid.Column="1"
Spacing="5">
<Button Text="Save" Clicked="SaveButton_Clicked"/>
<Button Text="Save"
Command="{Binding SaveCommand}"/>
<Button Text="Cancel" />
</HorizontalStackLayout>
</Grid>