diff --git a/MVVMwithWPF/MVVMwithWPF/App.xaml b/MVVMwithWPF/MVVMwithWPF/App.xaml index 023a98b..bf6eae3 100644 --- a/MVVMwithWPF/MVVMwithWPF/App.xaml +++ b/MVVMwithWPF/MVVMwithWPF/App.xaml @@ -2,6 +2,6 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:MVVMwithWPF" - StartupUri="/Views/MainWindow.xaml"> + StartupUri="/Views/BindingSampleWindow.xaml"> diff --git a/MVVMwithWPF/MVVMwithWPF/Models/Person.cs b/MVVMwithWPF/MVVMwithWPF/Models/Person.cs new file mode 100644 index 0000000..8687833 --- /dev/null +++ b/MVVMwithWPF/MVVMwithWPF/Models/Person.cs @@ -0,0 +1,16 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MVVMwithWPF.Models +{ + public class Person + { + public int Id { get; set; } + public string Name { get; set; } + public bool Sex { get; set; } + } +} diff --git a/MVVMwithWPF/MVVMwithWPF/ViewModels/BindindSampleViewModel.cs b/MVVMwithWPF/MVVMwithWPF/ViewModels/BindindSampleViewModel.cs new file mode 100644 index 0000000..c535c06 --- /dev/null +++ b/MVVMwithWPF/MVVMwithWPF/ViewModels/BindindSampleViewModel.cs @@ -0,0 +1,40 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using MVVMwithWPF.Models; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MVVMwithWPF.ViewModels +{ + internal partial class BindindSampleViewModel : ViewModelBase + { + [ObservableProperty] + private ObservableCollection _persons; + [ObservableProperty] + private int _id; + [ObservableProperty] + private string _name; + [ObservableProperty] + private bool _sex; + [ObservableProperty] + private ObservableCollection _sexes; + + public BindindSampleViewModel() + { + Persons = new ObservableCollection() + { + new Person() { Id = 11, Name = "person001", Sex = true }, + new Person() { Id = 22, Name = "person002", Sex = false }, + }; + + Sexes = new ObservableCollection() { true, false }; + + Id = 99; + Name = "person000"; + Sex = false; + } + } +} diff --git a/MVVMwithWPF/MVVMwithWPF/Views/BindingSampleWindow.xaml b/MVVMwithWPF/MVVMwithWPF/Views/BindingSampleWindow.xaml new file mode 100644 index 0000000..eed7eb2 --- /dev/null +++ b/MVVMwithWPF/MVVMwithWPF/Views/BindingSampleWindow.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MVVMwithWPF/MVVMwithWPF/Views/BindingSampleWindow.xaml.cs b/MVVMwithWPF/MVVMwithWPF/Views/BindingSampleWindow.xaml.cs new file mode 100644 index 0000000..aa46405 --- /dev/null +++ b/MVVMwithWPF/MVVMwithWPF/Views/BindingSampleWindow.xaml.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace MVVMwithWPF.Views +{ + /// + /// BindingSampleWindow.xaml에 대한 상호 작용 논리 + /// + public partial class BindingSampleWindow : Window + { + public BindingSampleWindow() + { + InitializeComponent(); + } + } +}