diff --git a/App.xaml b/App.xaml
new file mode 100644
index 0000000..cb15d5b
--- /dev/null
+++ b/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/App.xaml.cs b/App.xaml.cs
new file mode 100644
index 0000000..45b4126
--- /dev/null
+++ b/App.xaml.cs
@@ -0,0 +1,14 @@
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace MVVM_DEMO
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+
+}
diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs
new file mode 100644
index 0000000..b0ec827
--- /dev/null
+++ b/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/MVVM_DEMO.csproj b/MVVM_DEMO.csproj
new file mode 100644
index 0000000..c4da95b
--- /dev/null
+++ b/MVVM_DEMO.csproj
@@ -0,0 +1,15 @@
+
+
+
+ WinExe
+ net8.0-windows
+ enable
+ enable
+ true
+
+
+
+
+
+
+
diff --git a/MVVM_DEMO.sln b/MVVM_DEMO.sln
new file mode 100644
index 0000000..da839ef
--- /dev/null
+++ b/MVVM_DEMO.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.13.35919.96 d17.13
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVVM_DEMO", "MVVM_DEMO.csproj", "{FBB9EB22-3115-4366-8C35-A300DA922B06}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FBB9EB22-3115-4366-8C35-A300DA922B06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FBB9EB22-3115-4366-8C35-A300DA922B06}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FBB9EB22-3115-4366-8C35-A300DA922B06}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FBB9EB22-3115-4366-8C35-A300DA922B06}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A0C2E5CF-A025-4D96-B992-801A8719AA75}
+ EndGlobalSection
+EndGlobal
diff --git a/Models/Product.cs b/Models/Product.cs
new file mode 100644
index 0000000..56bb692
--- /dev/null
+++ b/Models/Product.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MVVM_DEMO.Models
+{
+ public class Product
+ {
+ public string ProductName { get; set; }
+ public double Price { get; set; }
+
+ }
+}
diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs
new file mode 100644
index 0000000..6499a0b
--- /dev/null
+++ b/ViewModels/MainViewModel.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MVVM_DEMO.Models;
+
+namespace MVVM_DEMO.ViewModels
+{
+ public class MainViewModel : INotifyPropertyChanged
+ {
+
+
+ private ObservableCollection _products;
+
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ public void OnPropertyChanged(string propertyName)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ // constructor
+
+ public MainViewModel()
+ {
+ _products = new ObservableCollection();
+ LoadData();
+ }
+
+ // read data
+ private void LoadData()
+ {
+ _products.Add(new Product { ProductName = "Product 1", Price = 10.0 });
+ _products.Add(new Product { ProductName = "Product 2", Price = 20.0 });
+ _products.Add(new Product { ProductName = "Product 3", Price = 30.0 });
+ Products = _products;
+ }
+
+
+ // properties
+ public ObservableCollection Products { get; set; }
+
+ public string productName { get; set; }
+ public int productPrice { get; set; }
+
+ }
+}
diff --git a/Views/MainWindow.xaml b/Views/MainWindow.xaml
new file mode 100644
index 0000000..21f4ec2
--- /dev/null
+++ b/Views/MainWindow.xaml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Views/MainWindow.xaml.cs b/Views/MainWindow.xaml.cs
new file mode 100644
index 0000000..d158a60
--- /dev/null
+++ b/Views/MainWindow.xaml.cs
@@ -0,0 +1,59 @@
+using MVVM_DEMO.Models;
+using MVVM_DEMO.ViewModels;
+using System.Text;
+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.Navigation;
+using System.Windows.Shapes;
+
+namespace MVVM_DEMO
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ MainViewModel viewModel = new MainViewModel();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ this.DataContext = viewModel;
+ comboBox.SelectionChanged += ComboBox_SelectionChanged;
+ // initial selection
+ if (comboBox.Items.Count > 0)
+ {
+ comboBox.SelectedIndex = 0;
+ }
+ }
+
+ private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ // display selected product details
+ if (comboBox.SelectedItem != null)
+ {
+ viewModel.productName= ((Product)comboBox.SelectedItem).ProductName;
+ viewModel.productPrice = (int)((Product)comboBox.SelectedItem).Price;
+ viewModel.OnPropertyChanged("productName");
+ viewModel.OnPropertyChanged("productPrice");
+ }
+
+ }
+
+ private void btnAddProduct_Click(object sender, RoutedEventArgs e)
+ {
+ // toevoegen van een product in het viewmodel
+ Product p = new Product();
+ p.ProductName = $"Product {viewModel.Products.Count + 1}";
+ // generate a random price between 10 and 100
+ Random rand = new Random();
+ p.Price = rand.Next(10, 100);
+ viewModel.Products.Add(p);
+ }
+ }
+}
\ No newline at end of file