diff --git a/PacticeSolution/DependencyProperty/App.xaml b/PacticeSolution/DependencyProperty/App.xaml
new file mode 100644
index 0000000..113dbde
--- /dev/null
+++ b/PacticeSolution/DependencyProperty/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/PacticeSolution/DependencyProperty/App.xaml.cs b/PacticeSolution/DependencyProperty/App.xaml.cs
new file mode 100644
index 0000000..d1901ac
--- /dev/null
+++ b/PacticeSolution/DependencyProperty/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace DependencyPropertySample
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/PacticeSolution/DependencyProperty/AssemblyInfo.cs b/PacticeSolution/DependencyProperty/AssemblyInfo.cs
new file mode 100644
index 0000000..8b5504e
--- /dev/null
+++ b/PacticeSolution/DependencyProperty/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/PacticeSolution/DependencyProperty/DependencyPropertySample.csproj b/PacticeSolution/DependencyProperty/DependencyPropertySample.csproj
new file mode 100644
index 0000000..4106cb0
--- /dev/null
+++ b/PacticeSolution/DependencyProperty/DependencyPropertySample.csproj
@@ -0,0 +1,10 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+
diff --git a/PacticeSolution/DependencyProperty/MainWindow.xaml b/PacticeSolution/DependencyProperty/MainWindow.xaml
new file mode 100644
index 0000000..72e8a9d
--- /dev/null
+++ b/PacticeSolution/DependencyProperty/MainWindow.xaml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PacticeSolution/DependencyProperty/MainWindow.xaml.cs b/PacticeSolution/DependencyProperty/MainWindow.xaml.cs
new file mode 100644
index 0000000..2a8d478
--- /dev/null
+++ b/PacticeSolution/DependencyProperty/MainWindow.xaml.cs
@@ -0,0 +1,60 @@
+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.Navigation;
+using System.Windows.Shapes;
+
+namespace DependencyPropertySample
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ // Dependency Property
+ public static readonly DependencyProperty MyProperty = DependencyProperty.Register(nameof(MyFruit), typeof(string), typeof(MainWindow), new FrameworkPropertyMetadata(new PropertyChangedCallback(OnMyPropertyChanged)));
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+
+ public string MyFruit
+ {
+ get { return (string)GetValue(MyProperty); }
+ set { SetValue(MyProperty, value); }
+ }
+
+ public static void OnMyPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
+ {
+ MainWindow win = o as MainWindow;
+ if (win == null)
+ return;
+
+ win.Title = (e.OldValue == null) ? "Not selected" : $"Old value is {e.OldValue.ToString()}";
+ win.txtFruit.Text = e.NewValue.ToString();
+ }
+
+ private void cboMain_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ ComboBox cb = sender as ComboBox;
+ if (cb == null)
+ return;
+
+ ComboBoxItem item = cb.SelectedItem as ComboBoxItem;
+ if (item == null)
+ return;
+
+ MyFruit = item.Content.ToString();
+ }
+ }
+}
diff --git a/PacticeSolution/MVVMComboBoxSample/App.xaml b/PacticeSolution/MVVMComboBoxSample/App.xaml
new file mode 100644
index 0000000..b8e4cdf
--- /dev/null
+++ b/PacticeSolution/MVVMComboBoxSample/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/PacticeSolution/MVVMComboBoxSample/App.xaml.cs b/PacticeSolution/MVVMComboBoxSample/App.xaml.cs
new file mode 100644
index 0000000..a89c371
--- /dev/null
+++ b/PacticeSolution/MVVMComboBoxSample/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace MVVMComboBoxSample
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/PacticeSolution/MVVMComboBoxSample/AssemblyInfo.cs b/PacticeSolution/MVVMComboBoxSample/AssemblyInfo.cs
new file mode 100644
index 0000000..8b5504e
--- /dev/null
+++ b/PacticeSolution/MVVMComboBoxSample/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/PacticeSolution/MVVMComboBoxSample/MVVMComboBoxSample.csproj b/PacticeSolution/MVVMComboBoxSample/MVVMComboBoxSample.csproj
new file mode 100644
index 0000000..4106cb0
--- /dev/null
+++ b/PacticeSolution/MVVMComboBoxSample/MVVMComboBoxSample.csproj
@@ -0,0 +1,10 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+
diff --git a/PacticeSolution/MVVMComboBoxSample/MainWindow.xaml b/PacticeSolution/MVVMComboBoxSample/MainWindow.xaml
new file mode 100644
index 0000000..3c56c25
--- /dev/null
+++ b/PacticeSolution/MVVMComboBoxSample/MainWindow.xaml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PacticeSolution/MVVMComboBoxSample/MainWindow.xaml.cs b/PacticeSolution/MVVMComboBoxSample/MainWindow.xaml.cs
new file mode 100644
index 0000000..8c917f7
--- /dev/null
+++ b/PacticeSolution/MVVMComboBoxSample/MainWindow.xaml.cs
@@ -0,0 +1,28 @@
+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.Navigation;
+using System.Windows.Shapes;
+
+namespace MVVMComboBoxSample
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/PacticeSolution/MVVMComboBoxSample/Model/Student.cs b/PacticeSolution/MVVMComboBoxSample/Model/Student.cs
new file mode 100644
index 0000000..e935d29
--- /dev/null
+++ b/PacticeSolution/MVVMComboBoxSample/Model/Student.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MVVMComboBoxSample.Model
+{
+ internal class Student
+ {
+ public string ID { get; set; }
+
+ public string Name { get; set; }
+
+ public int Age { get; set; }
+ }
+}
diff --git a/PacticeSolution/MVVMComboBoxSample/ViewModel/StudentViewModel.cs b/PacticeSolution/MVVMComboBoxSample/ViewModel/StudentViewModel.cs
new file mode 100644
index 0000000..ea55c71
--- /dev/null
+++ b/PacticeSolution/MVVMComboBoxSample/ViewModel/StudentViewModel.cs
@@ -0,0 +1,28 @@
+using MVVMComboBoxSample.Model;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MVVMComboBoxSample.ViewModel
+{
+ internal class StudentViewModel
+ {
+ public ObservableCollection Students { get; set; }
+
+ public Student SelectedStudent { get; set; }
+
+ public StudentViewModel()
+ {
+ this.Students = new ObservableCollection()
+ {
+ new Student() { ID = Guid.NewGuid().ToString(), Name = "Joe", Age = 20 },
+ new Student() { ID = Guid.NewGuid().ToString(), Name = "Jane", Age = 21 },
+ new Student() { ID = Guid.NewGuid().ToString(), Name = "Rick", Age = 22 },
+ new Student() { ID = Guid.NewGuid().ToString(), Name = "Paul", Age = 23 },
+ };
+ }
+ }
+}
diff --git a/PacticeSolution/PacticeSolution.sln b/PacticeSolution/PacticeSolution.sln
index 7755cac..3aa745a 100644
--- a/PacticeSolution/PacticeSolution.sln
+++ b/PacticeSolution/PacticeSolution.sln
@@ -31,6 +31,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageLoader", "ImageLoader\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlUISample", "XamlUISample\XamlUISample.csproj", "{CBB0126E-291E-47F0-82D4-B7D78439BC4C}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DependencyPropertySample", "DependencyProperty\DependencyPropertySample.csproj", "{7DED7470-62BB-4042-B161-98F9605046B2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVVMComboBoxSample", "MVVMComboBoxSample\MVVMComboBoxSample.csproj", "{86DDE4C6-1359-4EB7-BEE6-13EC137F081D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -93,6 +97,14 @@ Global
{CBB0126E-291E-47F0-82D4-B7D78439BC4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBB0126E-291E-47F0-82D4-B7D78439BC4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CBB0126E-291E-47F0-82D4-B7D78439BC4C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7DED7470-62BB-4042-B161-98F9605046B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7DED7470-62BB-4042-B161-98F9605046B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7DED7470-62BB-4042-B161-98F9605046B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7DED7470-62BB-4042-B161-98F9605046B2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {86DDE4C6-1359-4EB7-BEE6-13EC137F081D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {86DDE4C6-1359-4EB7-BEE6-13EC137F081D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {86DDE4C6-1359-4EB7-BEE6-13EC137F081D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {86DDE4C6-1359-4EB7-BEE6-13EC137F081D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE