diff --git a/PacticeSolution/BindingValidationRuleSample/App.xaml b/PacticeSolution/BindingValidationRuleSample/App.xaml
new file mode 100644
index 0000000..7dc6318
--- /dev/null
+++ b/PacticeSolution/BindingValidationRuleSample/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/PacticeSolution/BindingValidationRuleSample/App.xaml.cs b/PacticeSolution/BindingValidationRuleSample/App.xaml.cs
new file mode 100644
index 0000000..bdb47a9
--- /dev/null
+++ b/PacticeSolution/BindingValidationRuleSample/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 BindingValidationRuleSample
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/PacticeSolution/BindingValidationRuleSample/AssemblyInfo.cs b/PacticeSolution/BindingValidationRuleSample/AssemblyInfo.cs
new file mode 100644
index 0000000..8b5504e
--- /dev/null
+++ b/PacticeSolution/BindingValidationRuleSample/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/BindingValidationRuleSample/BindingValidationRuleSample.csproj b/PacticeSolution/BindingValidationRuleSample/BindingValidationRuleSample.csproj
new file mode 100644
index 0000000..4106cb0
--- /dev/null
+++ b/PacticeSolution/BindingValidationRuleSample/BindingValidationRuleSample.csproj
@@ -0,0 +1,10 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+
+
+
diff --git a/PacticeSolution/BindingValidationRuleSample/MainWindow.xaml b/PacticeSolution/BindingValidationRuleSample/MainWindow.xaml
new file mode 100644
index 0000000..9e6e75a
--- /dev/null
+++ b/PacticeSolution/BindingValidationRuleSample/MainWindow.xaml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PacticeSolution/BindingValidationRuleSample/MainWindow.xaml.cs b/PacticeSolution/BindingValidationRuleSample/MainWindow.xaml.cs
new file mode 100644
index 0000000..f5a8263
--- /dev/null
+++ b/PacticeSolution/BindingValidationRuleSample/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 BindingValidationRuleSample
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/PacticeSolution/BindingValidationRuleSample/Model/Student.cs b/PacticeSolution/BindingValidationRuleSample/Model/Student.cs
new file mode 100644
index 0000000..be883db
--- /dev/null
+++ b/PacticeSolution/BindingValidationRuleSample/Model/Student.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BindingValidationRuleSample.Model
+{
+ public class Student : INotifyPropertyChanged
+ {
+ private string _name;
+ private string _age;
+ private string _phoneNumber;
+
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ public Student(string name, string age, string number)
+ {
+
+ }
+
+ public Student() : this("Name", "20", "123-456-7890")
+ {
+
+ }
+
+ public string Name
+ {
+ get { return _name; }
+ set
+ {
+ _name = value;
+ OnPropertyChanged(nameof(this.Name));
+ }
+ }
+
+ public string Age
+ {
+ get { return _age; }
+ set
+ {
+ _age = value;
+ OnPropertyChanged(nameof(this.Age));
+ }
+ }
+
+ public string PhoneNumber
+ {
+ get { return _phoneNumber; }
+ set
+ {
+ _phoneNumber = value;
+ OnPropertyChanged(nameof(this.PhoneNumber));
+ }
+ }
+
+ private void OnPropertyChanged(string propertyName)
+ {
+ if (this.PropertyChanged == null)
+ return;
+
+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
diff --git a/PacticeSolution/BindingValidationRuleSample/Validation/AgeRangeException.cs b/PacticeSolution/BindingValidationRuleSample/Validation/AgeRangeException.cs
new file mode 100644
index 0000000..c1e8018
--- /dev/null
+++ b/PacticeSolution/BindingValidationRuleSample/Validation/AgeRangeException.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+
+namespace BindingValidationRuleSample.Validation
+{
+ public class AgeRangeException : ValidationRule
+ {
+ public int MinAge { get; set; } = 0;
+ public int MaxAge { get; set; } = 150;
+
+ public override ValidationResult Validate(object value, CultureInfo cultureInfo)
+ {
+ int age = 0;
+ if (!int.TryParse(value.ToString(), out age))
+ return new ValidationResult(false, "Wrong value.");
+
+ if (age >= this.MinAge && age <= this.MaxAge)
+ return new ValidationResult(true, null);
+ else
+ return new ValidationResult(false, $"Valid age range is {this.MinAge}~{this.MaxAge}");
+ }
+ }
+}
diff --git a/PacticeSolution/PacticeSolution.sln b/PacticeSolution/PacticeSolution.sln
index 92602cf..8e24b32 100644
--- a/PacticeSolution/PacticeSolution.sln
+++ b/PacticeSolution/PacticeSolution.sln
@@ -53,6 +53,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TabControlSample", "TabCont
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProgressBarSample", "ProgressBarSample\ProgressBarSample.csproj", "{EB304FB7-67EA-467E-9BE4-E55187415CAB}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BindingValidationRuleSample", "BindingValidationRuleSample\BindingValidationRuleSample.csproj", "{B328C31A-8C85-4A48-A12F-26E11C37A15C}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -159,6 +161,10 @@ Global
{EB304FB7-67EA-467E-9BE4-E55187415CAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB304FB7-67EA-467E-9BE4-E55187415CAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB304FB7-67EA-467E-9BE4-E55187415CAB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B328C31A-8C85-4A48-A12F-26E11C37A15C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B328C31A-8C85-4A48-A12F-26E11C37A15C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B328C31A-8C85-4A48-A12F-26E11C37A15C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B328C31A-8C85-4A48-A12F-26E11C37A15C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PacticeSolution/TabControlSample/MainWindow.xaml b/PacticeSolution/TabControlSample/MainWindow.xaml
index 2d8bb5f..ae84641 100644
--- a/PacticeSolution/TabControlSample/MainWindow.xaml
+++ b/PacticeSolution/TabControlSample/MainWindow.xaml
@@ -7,7 +7,23 @@
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="400">
-
+
+
+
+
+