Implementing of viewModel handling for UI
This commit is contained in:
@ -4,13 +4,13 @@
|
||||
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.EntityLayer.EntityClasses;assembly=AdventureWorks.EntityLayer"
|
||||
x:DataType="vm:User"
|
||||
xmlns:vm="clr-namespace:AdventureWorks.ViewModelLayer;assembly=AdventureWorks.ViewModelLayer"
|
||||
x:DataType="vm:UserViewModel"
|
||||
Title="User Information">
|
||||
|
||||
<ContentPage.Resources>
|
||||
<converters:InvertedBoolConverter x:Key="invertedBoolean" />
|
||||
<vm:User x:Key="viewModel"
|
||||
<!--<vm:User x:Key="viewModel"
|
||||
LoginId="JohnSmith123"
|
||||
FirstName="John222"
|
||||
LastName="Smith"
|
||||
@ -24,11 +24,10 @@
|
||||
IsEnrolledInHSA="False"
|
||||
IsActive="True"
|
||||
BirthDate="10-03-1975"
|
||||
/>
|
||||
/>-->
|
||||
</ContentPage.Resources>
|
||||
|
||||
<Border Style="{StaticResource Border.Page}"
|
||||
BindingContext="{StaticResource viewModel}" >
|
||||
<Border Style="{StaticResource Border.Page}" >
|
||||
<ScrollView>
|
||||
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto,Auto, Auto, Auto , Auto"
|
||||
ColumnDefinitions="Auto, *"
|
||||
@ -45,7 +44,7 @@
|
||||
|
||||
<VerticalStackLayout Grid.Row="1"
|
||||
Grid.Column="1">
|
||||
<Entry Text="{Binding LoginId}"
|
||||
<Entry Text="{Binding UserObject.LoginId}"
|
||||
Placeholder="Please use a combination of letters and numbers."/>
|
||||
<Label FontSize="Micro"
|
||||
Text="Please use a combination of letters and numbers." />
|
||||
@ -54,17 +53,17 @@
|
||||
Text="First Name" />
|
||||
<Entry Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Text="{Binding FirstName}"/>
|
||||
Text="{Binding UserObject.FirstName}"/>
|
||||
<Label Grid.Row="3"
|
||||
Text="Last Name" />
|
||||
<Entry Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Text="{Binding LastName}"/>
|
||||
Text="{Binding UserObject.LastName}"/>
|
||||
<Label Grid.Row="4"
|
||||
Text="Email Address" />
|
||||
<Entry Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Text="{Binding Email}"/>
|
||||
Text="{Binding UserObject.Email}"/>
|
||||
<Label Grid.Row="5" Text="Is Enrolled ?"/>
|
||||
|
||||
<FlexLayout Grid.Row="5"
|
||||
@ -73,19 +72,19 @@
|
||||
Direction="Row">
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="401k?"/>
|
||||
<CheckBox IsChecked="{Binding IsEnrolledIn401k}"/>
|
||||
<CheckBox IsChecked="{Binding UserObject.IsEnrolledIn401k}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout >
|
||||
<Label Text="Flex Time?"/>
|
||||
<CheckBox x:Name="FlexTime" IsChecked="{Binding IsEnrolledInFlexTime}"/>
|
||||
<CheckBox x:Name="FlexTime" IsChecked="{Binding UserObject.IsEnrolledInFlexTime}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout >
|
||||
<Label Text="Health Care?"/>
|
||||
<CheckBox IsChecked="{Binding IsEnrolledInHealthCare}"/>
|
||||
<CheckBox IsChecked="{Binding UserObject.IsEnrolledInHealthCare}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout >
|
||||
<Label Text="Health Savings Account?"/>
|
||||
<CheckBox IsChecked="{Binding IsEnrolledInHSA}"/>
|
||||
<CheckBox IsChecked="{Binding UserObject.IsEnrolledInHSA}"/>
|
||||
</HorizontalStackLayout>
|
||||
</FlexLayout>
|
||||
|
||||
@ -93,7 +92,7 @@
|
||||
Text="Still Employed"/>
|
||||
<Switch Grid.Row="6"
|
||||
Grid.Column="1"
|
||||
IsToggled="{Binding IsActive}"/>
|
||||
IsToggled="{Binding UserObject.IsActive}"/>
|
||||
<Label Text="Employee Type"
|
||||
Grid.Row="7"/>
|
||||
<FlexLayout Grid.Row="7"
|
||||
@ -103,12 +102,12 @@
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="Full-Time"/>
|
||||
<RadioButton x:Name="FullTime"
|
||||
IsChecked="{Binding IsFullTime}"
|
||||
IsChecked="{Binding UserObject.IsFullTime}"
|
||||
GroupName="EmployeeType"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="Part-Time"/>
|
||||
<RadioButton GroupName="EmployeeType" IsChecked="{Binding IsFullTime, Converter={StaticResource invertedBoolean}}"/>
|
||||
<RadioButton GroupName="EmployeeType" IsChecked="{Binding UserObject.IsFullTime, Converter={StaticResource invertedBoolean}}"/>
|
||||
</HorizontalStackLayout>
|
||||
</FlexLayout>
|
||||
|
||||
@ -116,14 +115,14 @@
|
||||
Grid.Row="8"/>
|
||||
<DatePicker Grid.Row="8"
|
||||
Grid.Column="1"
|
||||
Date="{Binding BirthDate}"
|
||||
Date="{Binding UserObject.BirthDate}"
|
||||
HorizontalOptions="Start"/>
|
||||
<Label Text="Start Time"
|
||||
Grid.Row="9"/>
|
||||
<TimePicker Grid.Row="9"
|
||||
Grid.Column="1"
|
||||
Time="{Binding StartTime}"
|
||||
IsEnabled="{Binding IsFullTime, Converter={StaticResource invertedBoolean}}"/>
|
||||
Time="{Binding UserObject.StartTime}"
|
||||
IsEnabled="{Binding UserObject.IsFullTime, Converter={StaticResource invertedBoolean}}"/>
|
||||
|
||||
<Label Text="Phone"
|
||||
Grid.Row="10"/>
|
||||
@ -133,11 +132,11 @@
|
||||
Direction="Row">
|
||||
<HorizontalStackLayout>
|
||||
<Entry MinimumWidthRequest="120"
|
||||
Text="{Binding Phone}"/>
|
||||
Text="{Binding UserObject.Phone}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Picker ItemsSource="{StaticResource phoneTypes}"
|
||||
SelectedItem="{Binding PhoneType}"/>
|
||||
<Picker ItemsSource="{StaticResource UserObject.phoneTypes}"
|
||||
SelectedItem="{Binding UserObject.PhoneType}"/>
|
||||
</HorizontalStackLayout>
|
||||
</FlexLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user