Implementing of viewModel handling for UI

This commit is contained in:
2025-08-19 16:50:53 +02:00
parent 86daaa5133
commit 2f053dfc71
8 changed files with 139 additions and 33 deletions

View File

@ -1,5 +1,4 @@
using AdventureWorks.EntityLayer.EntityClasses;
using AdventureWorks.ViewModelLayer;
namespace AdventureWorks.MAUI.Views;
public partial class UserDetailView : ContentPage
@ -7,20 +6,20 @@ public partial class UserDetailView : ContentPage
public UserDetailView()
{
InitializeComponent();
UserObject = (User)this.Resources["viewModel"];
UserObject.LoginId = "jkzxck0q94375";
}
public User UserObject { get; set; }
public UserViewModel ViewModel { get; set; }
protected override void OnAppearing()
{
base.OnAppearing();
UserObject.LoginId = "PeterPiper384";
UserObject.FirstName = "Peter";
UserObject.LastName = "Piper";
UserObject.Email = "peter@piper.com";
ViewModel = new();
BindingContext = ViewModel;
ViewModel.Get(1); // Assuming you want to get the user with ID 1
}
private void SaveButton_Clicked(object sender, EventArgs e)
{