First connection with entity object UI to Object
This commit is contained in:
@ -64,6 +64,10 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AdventureWorks.EntityLayer\AdventureWorks.EntityLayer.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\LoginView.xaml.cs">
|
||||
<DependentUpon>LoginView.xaml</DependentUpon>
|
||||
|
||||
@ -5,6 +5,11 @@
|
||||
x:Class="AdventureWorks.MAUI.App">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<x:Array x:Key="phoneTypes" Type="{x:Type x:String}">
|
||||
<x:String>Home</x:String>
|
||||
<x:String>Mobile</x:String>
|
||||
<x:String>Other</x:String>
|
||||
</x:Array>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
|
||||
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
|
||||
|
||||
@ -4,13 +4,31 @@
|
||||
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"
|
||||
Title="User Information">
|
||||
|
||||
<ContentPage.Resources>
|
||||
<converters:InvertedBoolConverter x:Key="invertedBoolean" />
|
||||
<vm:User x:Key="viewModel"
|
||||
LoginId="JohnSmith123"
|
||||
FirstName="John222"
|
||||
LastName="Smith"
|
||||
Email="john@smith.com"
|
||||
Phone="615.222.2333"
|
||||
PhoneType="Mobile"
|
||||
IsFullTime="True"
|
||||
IsEnrolledIn401k="True"
|
||||
IsEnrolledInFlexTime="False"
|
||||
IsEnrolledInHealthCare="True"
|
||||
IsEnrolledInHSA="False"
|
||||
IsActive="True"
|
||||
BirthDate="10-03-1975"
|
||||
/>
|
||||
</ContentPage.Resources>
|
||||
|
||||
<Border Style="{StaticResource Border.Page}">
|
||||
<Border Style="{StaticResource Border.Page}"
|
||||
BindingContext="{StaticResource viewModel}" >
|
||||
<ScrollView>
|
||||
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto,Auto, Auto, Auto , Auto"
|
||||
ColumnDefinitions="Auto, *"
|
||||
@ -23,11 +41,11 @@
|
||||
ViewDescription="Use this Screen to Modify User Information." />
|
||||
|
||||
<Label Grid.Row="1"
|
||||
Text="Login ID" />
|
||||
Text="Login ID" />
|
||||
|
||||
<VerticalStackLayout Grid.Row="3"
|
||||
<VerticalStackLayout Grid.Row="1"
|
||||
Grid.Column="1">
|
||||
<Entry Text=""
|
||||
<Entry Text="{Binding LoginId}"
|
||||
Placeholder="Please use a combination of letters and numbers."/>
|
||||
<Label FontSize="Micro"
|
||||
Text="Please use a combination of letters and numbers." />
|
||||
@ -36,17 +54,17 @@
|
||||
Text="First Name" />
|
||||
<Entry Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Text=""/>
|
||||
Text="{Binding FirstName}"/>
|
||||
<Label Grid.Row="3"
|
||||
Text="Last Name" />
|
||||
<Entry Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Text=""/>
|
||||
Text="{Binding LastName}"/>
|
||||
<Label Grid.Row="4"
|
||||
Text="Email Address" />
|
||||
<Entry Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Text=""/>
|
||||
Text="{Binding Email}"/>
|
||||
<Label Grid.Row="5" Text="Is Enrolled ?"/>
|
||||
|
||||
<FlexLayout Grid.Row="5"
|
||||
@ -55,26 +73,27 @@
|
||||
Direction="Row">
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="401k?"/>
|
||||
<CheckBox IsChecked="True"/>
|
||||
<CheckBox IsChecked="{Binding IsEnrolledIn401k}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout >
|
||||
<Label Text="Flex Time?"/>
|
||||
<CheckBox x:Name="FlexTime"/>
|
||||
<CheckBox x:Name="FlexTime" IsChecked="{Binding IsEnrolledInFlexTime}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout >
|
||||
<Label Text="Health Care?"/>
|
||||
<CheckBox IsChecked="True"/>
|
||||
<CheckBox IsChecked="{Binding IsEnrolledInHealthCare}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout >
|
||||
<Label Text="Health Savings Account?"/>
|
||||
<CheckBox IsChecked="True"/>
|
||||
<CheckBox IsChecked="{Binding IsEnrolledInHSA}"/>
|
||||
</HorizontalStackLayout>
|
||||
</FlexLayout>
|
||||
|
||||
<Label Grid.Row="6"
|
||||
Text="Still Employed"/>
|
||||
<Switch Grid.Row="6"
|
||||
Grid.Column="1"/>
|
||||
Grid.Column="1"
|
||||
IsToggled="{Binding IsActive}"/>
|
||||
<Label Text="Employee Type"
|
||||
Grid.Row="7"/>
|
||||
<FlexLayout Grid.Row="7"
|
||||
@ -84,12 +103,12 @@
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="Full-Time"/>
|
||||
<RadioButton x:Name="FullTime"
|
||||
IsChecked="True"
|
||||
IsChecked="{Binding IsFullTime}"
|
||||
GroupName="EmployeeType"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Label Text="Part-Time"/>
|
||||
<RadioButton GroupName="EmployeeType"/>
|
||||
<RadioButton GroupName="EmployeeType" IsChecked="{Binding IsFullTime, Converter={StaticResource invertedBoolean}}"/>
|
||||
</HorizontalStackLayout>
|
||||
</FlexLayout>
|
||||
|
||||
@ -97,14 +116,14 @@
|
||||
Grid.Row="8"/>
|
||||
<DatePicker Grid.Row="8"
|
||||
Grid.Column="1"
|
||||
Date="{Binding BirthDate}"
|
||||
HorizontalOptions="Start"/>
|
||||
<Label Text="Start Time"
|
||||
Grid.Row="9"/>
|
||||
<TimePicker Grid.Row="9"
|
||||
Grid.Column="1"
|
||||
Time="06:00:00"
|
||||
BindingContext="{x:Reference FullTime}"
|
||||
IsEnabled="{Binding IsChecked, Converter={StaticResource invertedBoolean}}"/>
|
||||
Time="{Binding StartTime}"
|
||||
IsEnabled="{Binding IsFullTime, Converter={StaticResource invertedBoolean}}"/>
|
||||
|
||||
<Label Text="Phone"
|
||||
Grid.Row="10"/>
|
||||
@ -113,18 +132,12 @@
|
||||
Wrap="Wrap"
|
||||
Direction="Row">
|
||||
<HorizontalStackLayout>
|
||||
<Entry MinimumWidthRequest="120"/>
|
||||
<Entry MinimumWidthRequest="120"
|
||||
Text="{Binding Phone}"/>
|
||||
</HorizontalStackLayout>
|
||||
<HorizontalStackLayout>
|
||||
<Picker>
|
||||
<Picker.ItemsSource>
|
||||
<x:Array Type="{x:Type x:String}">
|
||||
<x:String>Home</x:String>
|
||||
<x:String>Mobile</x:String>
|
||||
<x:String>Other</x:String>
|
||||
</x:Array>
|
||||
</Picker.ItemsSource>
|
||||
</Picker>
|
||||
<Picker ItemsSource="{StaticResource phoneTypes}"
|
||||
SelectedItem="{Binding PhoneType}"/>
|
||||
</HorizontalStackLayout>
|
||||
</FlexLayout>
|
||||
|
||||
@ -134,7 +147,7 @@
|
||||
<HorizontalStackLayout Grid.Row="12"
|
||||
Grid.Column="1"
|
||||
Spacing="5">
|
||||
<Button Text="Save" />
|
||||
<Button Text="Save" Clicked="SaveButton_Clicked"/>
|
||||
<Button Text="Cancel" />
|
||||
</HorizontalStackLayout>
|
||||
</Grid>
|
||||
|
||||
@ -1,9 +1,19 @@
|
||||
using AdventureWorks.EntityLayer.EntityClasses;
|
||||
|
||||
namespace AdventureWorks.MAUI.Views;
|
||||
|
||||
public partial class UserDetailView : ContentPage
|
||||
{
|
||||
public UserDetailView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public UserDetailView()
|
||||
{
|
||||
InitializeComponent();
|
||||
UserObject = (User)this.Resources["viewModel"];
|
||||
}
|
||||
|
||||
public User UserObject { get; set; }
|
||||
|
||||
private void SaveButton_Clicked(object sender, EventArgs e)
|
||||
{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user