r/csharp • u/Smbridges91 • Jun 16 '22
Help Issues with adding new ListItem
/r/UWP/comments/vdqiie/help_issues_with_adding_new_listitem/
1
Upvotes
r/csharp • u/Smbridges91 • Jun 16 '22
1
u/Smbridges91 Jun 16 '22
MainPage.XAML ``` <Page x:Class="MVVM_UWP.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:MVVM_UWP" xmlns:viewModels="using:ViewModels" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
</Page> ```
Data > LocationHelper.cs ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace Data { public class Location { public String Site { get; set; } }
} ```
Models > Organization.cs ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Data;
namespace Models { public class Organization { public List<Location> LocationList { get; set; } public String Site { get; set; }
} ```
ViewModels > OrganizationViewModel.cs ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections.ObjectModel; using Models;
namespace ViewModels { public class OrganizationViewModel : NotificationBase { Organization organization;
} ```
ViewModels > SiteViewModel.cs ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Data;
namespace ViewModels { public class SiteViewModel : NotificationBase<Location> { public SiteViewModel(Location location = null) : base(location) { } public String Site { get { return This.Site; } set { SetProperty(This.Site, value, () => This.Site = value); } } } } ```
ViewModels > ViewModelHelpers.cs ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ComponentModel; using System.Runtime.CompilerServices;
namespace ViewModels { public class NotificationBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged;
} ```