├── .editorconfig
├── .github
└── dependabot.yml
├── .gitignore
├── Gu.Wpf.ValidationScope.Demo
├── .editorconfig
├── App.xaml
├── App.xaml.cs
├── AssemblyAttributes.cs
├── ComplicatedScopeView.xaml
├── ComplicatedScopeView.xaml.cs
├── ControlTemplatesView.xaml
├── ControlTemplatesView.xaml.cs
├── Converters
│ ├── BoolToBrushConverter.cs
│ └── NullToVisibilityConverter.cs
├── DataGridScopeView.xaml
├── DataGridScopeView.xaml.cs
├── DataGridScopeVm.cs
├── DataTemplatesView.xaml
├── DataTemplatesView.xaml.cs
├── DynamicTypesView.xaml
├── DynamicTypesView.xaml.cs
├── Gu.Wpf.ValidationScope.Demo.csproj
├── Gu.Wpf.ValidationScope.Demo.csproj.DotSettings
├── InputTypesView.xaml
├── InputTypesView.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── NotifyDataErrorInfoView.xaml
├── NotifyDataErrorInfoView.xaml.cs
├── NotifyDataErrorInfoVm.cs
├── OneLevelScopeView.xaml
├── OneLevelScopeView.xaml.cs
├── OneWayToSourceBindingsView.xaml
├── OneWayToSourceBindingsView.xaml.cs
├── OneWayToSourceBindingsViewModel.cs
├── ParentChildScopesView.xaml
├── ParentChildScopesView.xaml.cs
├── RelayCommand.cs
├── SandboxView.xaml
├── SandboxView.xaml.cs
├── SandboxVm.cs
├── ScopeIsErrorScopeView.xaml
├── ScopeIsErrorScopeView.xaml.cs
├── ScopeIsErrorScopeVm.cs
├── TwoLevelScopeView.xaml
├── TwoLevelScopeView.xaml.cs
├── UiTestWindows
│ ├── ComplicatedScopeWindow.xaml
│ ├── ComplicatedScopeWindow.xaml.cs
│ ├── ContentTemplateSelector.cs
│ ├── ControlTemplatesWindow.xaml
│ ├── ControlTemplatesWindow.xaml.cs
│ ├── DataGridWindow.xaml
│ ├── DataGridWindow.xaml.cs
│ ├── DataTemplateSelectorWindow.xaml
│ ├── DataTemplateSelectorWindow.xaml.cs
│ ├── DataTemplatesWindow.xaml
│ ├── DataTemplatesWindow.xaml.cs
│ ├── DynamicTypesWindow.xaml
│ ├── DynamicTypesWindow.xaml.cs
│ ├── EventTemplateSelector.cs
│ ├── EventsOrderWindow.xaml
│ ├── EventsOrderWindow.xaml.cs
│ ├── LiveErrorsWindow.xaml
│ ├── LiveErrorsWindow.xaml.cs
│ ├── NotifyDataErrorInfoWindow.xaml
│ ├── NotifyDataErrorInfoWindow.xaml.cs
│ ├── OneLevelScopeWindow.xaml
│ ├── OneLevelScopeWindow.xaml.cs
│ ├── OneWayToSourceBindingsWindow.xaml
│ ├── OneWayToSourceBindingsWindow.xaml.cs
│ ├── ParentChildScopesWindow.xaml
│ ├── ParentChildScopesWindow.xaml.cs
│ ├── ScopeEvents.cs
│ ├── ScopeIsErrorScopeWindow.xaml
│ ├── ScopeIsErrorScopeWindow.xaml.cs
│ ├── ScopeTextBoxWindow.xaml
│ ├── ScopeTextBoxWindow.xaml.cs
│ ├── SimpleThreeLevelScopeWindow.xaml
│ ├── SimpleThreeLevelScopeWindow.xaml.cs
│ ├── SimpleTwoLevelWindow.xaml
│ ├── SimpleTwoLevelWindow.xaml.cs
│ ├── SimpleWindow.xaml
│ ├── SimpleWindow.xaml.cs
│ ├── TabControlWindow.xaml
│ ├── TabControlWindow.xaml.cs
│ ├── TabControlWindowViewModel.cs
│ ├── TwoLevelScopeWindow.xaml
│ ├── TwoLevelScopeWindow.xaml.cs
│ ├── ValidationEvents.cs
│ ├── VisibilityWindow.xaml
│ └── VisibilityWindow.xaml.cs
└── ViewModel.cs
├── Gu.Wpf.ValidationScope.Tests
├── .editorconfig
├── AssemblyAttributes.cs
├── ErrorCollection
│ └── ErrorCollectionTests.cs
├── Gu.Wpf.ValidationScope.Tests.csproj
├── Gu.Wpf.ValidationScope.Tests.csproj.DotSettings
├── Helpers
│ ├── ErrorCollectionExt.cs
│ ├── ErrorsChangedEventArgsComparer.cs
│ ├── Factory.cs
│ ├── GenericComparer.cs
│ ├── NotifyCollectionChangedEventArgsComparer.cs
│ ├── ObservableCollectionArgsComparer.cs
│ ├── ObservableCollectionExt.cs
│ ├── PropertyChangedEventArgsComparer.cs
│ ├── ScopeEventsExt.cs
│ ├── ScopeValidationErrorEventArgsComparer.cs
│ ├── TestHelpers.cs
│ ├── TestValidationError.cs
│ └── TestValidationRule.cs
└── InputTypes
│ └── InputTypeCollectionConverterTests.cs
├── Gu.Wpf.ValidationScope.UiTests
├── .editorconfig
├── AssemblyAttributes.cs
├── ComplicatedScopeWindowTests.cs
├── ControlTemplatesWindowTests.cs
├── DataGridWindowTests.cs
├── DataTemplateSelectorWindowTests.cs
├── DataTemplatesWindowTests.cs
├── DynamicTypesWindowTests.cs
├── EventsOrderWindowTests.cs
├── Gu.Wpf.ValidationScope.UiTests.csproj
├── Gu.Wpf.ValidationScope.UiTests.csproj.DotSettings
├── Helpers
│ ├── DumpAppDomain.cs
│ └── UiElementExt.cs
├── LiveErrorsWindowTests.cs
├── NotifyDataErrorInfoWindowTests.cs
├── OneLevelScopeWindowTests.cs
├── OneWayToSourceBindingsWindowTests.cs
├── ParentChildScopesWindowTests.cs
├── ScopeIsErrorScopeWindowTests.cs
├── ScopeTextBoxWindowTests.cs
├── SimpleThreeLevelScopeWindowTests.cs
├── SimpleTwoLevelWindowTests.cs
├── SimpleWindowTests.cs
├── TabControlWindowTests.cs
├── TwoLevelScopeWindowTests.cs
└── VisibilityWindowTests.cs
├── Gu.Wpf.ValidationScope.sln
├── Gu.Wpf.ValidationScope.sln.DotSettings
├── Gu.Wpf.ValidationScope.snk
├── Gu.Wpf.ValidationScope
├── .editorconfig
├── AssemblyAttributes.cs
├── ErrorCollection
│ ├── ErrorCollection.cs
│ ├── ErrorsChangedEventArgs.cs
│ ├── ErrorsChangedEventManager.cs
│ ├── INotifyErrorsChanged.cs
│ └── ObservableBatchCollection.cs
├── ErrorTree
│ ├── ChildCollection.cs
│ ├── ErrorNode.cs
│ ├── InputNode.cs
│ ├── Node.cs
│ ├── ScopeNode.cs
│ └── ValidNode.cs
├── Gu.Wpf.ValidationScope.csproj
├── Gu.Wpf.ValidationScope.csproj.DotSettings
├── InputTypes
│ ├── DefaultInputTypesExtension.cs
│ ├── InputTypeCollection.cs
│ ├── InputTypeCollectionConverter.cs
│ ├── InputTypesExtension.cs
│ ├── InputTypesExtensionCtors.generated.cs
│ └── InputTypesExtensionCtors.tt
├── Internal
│ ├── BindingHelper.cs
│ ├── BooleanBoxes.cs
│ ├── EnumerableExt.cs
│ └── IsVisibleChangedEventManager.cs
├── OneWayToSourceBindings.cs
├── PublicAPI.Shipped.txt
├── PublicAPI.Unshipped.txt
├── Scope.BubbleRoute.cs
├── Scope.Events.cs
├── Scope.cs
├── ScopeValidationErrorEventArgs.cs
└── stylecop.json
├── LICENSE.md
├── README.md
├── RELEASE_NOTES.md
├── Settings.XamlStyler
├── appveyor.yml
└── azure-pipelines.yml
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: nuget
4 | directory: "/"
5 | schedule:
6 | interval: daily
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ###### -- File Created With Git Source Control Provider 2015 -- ######
2 | ###### -- From https://github.com/github/gitignore -- ######
3 | ###### -- Warning Regenerating this file will erase all your custom ignores, unless you add them below the Custom Ignore section at the bottom -- ######
4 |
5 |
6 |
7 | ###### -- Custom Ignore Section, Make sure all files you add to the git repo are below this line -- ######
8 |
9 |
10 | Thumbs.db
11 | *.obj
12 | *.exe
13 | *.pdb
14 | *.user
15 | *.aps
16 | *.pch
17 | *.vspscc
18 | *_i.c
19 | *_p.c
20 | *.ncb
21 | *.suo
22 | *.sln.docstates
23 | *.tlb
24 | *.tlh
25 | *.bak
26 | *.cache
27 | *.ilk
28 | *.log
29 | [Bb]in
30 | [Dd]ebug*/
31 | *.lib
32 | *.sbr
33 | obj/
34 | [Rr]elease*/
35 | _ReSharper*/
36 | [Tt]est[Rr]esult*
37 | *.vssscc
38 | $tf*/
39 | *.dll
40 | packages/*
41 | publish/*
42 | [Aa]rtifacts/
43 | .vs/*
44 | /paket-files/*
45 | *.orig
46 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.cs]
2 |
3 | # Default severity for analyzer diagnostics with category 'StyleCop.CSharp.DocumentationRules'
4 | dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = none
5 | # SA0001: XML comment analysis is disabled due to project configuration
6 | dotnet_diagnostic.SA0001.severity = none
7 |
8 | # CA1062: Validate arguments of public methods
9 | dotnet_diagnostic.CA1062.severity = none
10 |
11 | # CA2109: Review visible event handlers
12 | dotnet_diagnostic.CA2109.severity = none
13 |
14 | # CA2227: Collection properties should be read only
15 | dotnet_diagnostic.CA2227.severity = none
16 |
17 | # SA1313: Parameter names should begin with lower-case letter
18 | dotnet_diagnostic.SA1313.severity = none
19 |
20 | # IDE1006: Naming Styles
21 | dotnet_diagnostic.IDE1006.severity = none
22 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System;
4 | using System.Windows;
5 |
6 | public partial class App : Application
7 | {
8 | protected override void OnStartup(StartupEventArgs e)
9 | {
10 | if (e.Args.Length == 1)
11 | {
12 | var window = e.Args[0];
13 | this.StartupUri = new Uri($"UiTestWindows/{window}.xaml", UriKind.Relative);
14 | }
15 |
16 | base.OnStartup(e);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/AssemblyAttributes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 |
4 | [assembly: CLSCompliant(false)]
5 |
6 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
7 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/ComplicatedScopeView.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System.Windows.Controls;
4 |
5 | public partial class ComplicatedScopeView : UserControl
6 | {
7 | public ComplicatedScopeView()
8 | {
9 | this.InitializeComponent();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/ControlTemplatesView.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
15 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
45 |
49 |
50 |
53 |
54 |
57 |
58 |
61 |
62 |
65 |
66 |
67 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/ControlTemplatesView.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System.Windows.Controls;
4 |
5 | public partial class ControlTemplatesView : UserControl
6 | {
7 | public ControlTemplatesView()
8 | {
9 | this.InitializeComponent();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/Converters/BoolToBrushConverter.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System;
4 | using System.Globalization;
5 | using System.Windows.Data;
6 | using System.Windows.Markup;
7 | using System.Windows.Media;
8 |
9 | [MarkupExtensionReturnType(typeof(BoolToBrushConverter))]
10 | [ValueConversion(typeof(bool), typeof(SolidColorBrush))]
11 | public class BoolToBrushConverter : MarkupExtension, IValueConverter
12 | {
13 | public SolidColorBrush WhenTrue { get; set; } = Brushes.Red;
14 |
15 | public SolidColorBrush WhenFalse { get; set; } = Brushes.Transparent;
16 |
17 | public override object ProvideValue(IServiceProvider serviceProvider)
18 | {
19 | return this;
20 | }
21 |
22 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
23 | {
24 | return Equals(value, true) ? this.WhenTrue : this.WhenFalse;
25 | }
26 |
27 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
28 | {
29 | throw new NotSupportedException();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/Converters/NullToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System;
4 | using System.Globalization;
5 | using System.Windows;
6 | using System.Windows.Data;
7 |
8 | [ValueConversion(typeof(object), typeof(Visibility))]
9 | public sealed class NullToVisibilityConverter : IValueConverter
10 | {
11 | public static readonly NullToVisibilityConverter CollapsedWhenNull = new(Visibility.Collapsed);
12 | private readonly Visibility whenNull;
13 |
14 | private NullToVisibilityConverter(Visibility whenNull)
15 | {
16 | this.whenNull = whenNull;
17 | }
18 |
19 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
20 | {
21 | return value is null ? this.whenNull : Visibility.Visible;
22 | }
23 |
24 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
25 | {
26 | throw new NotSupportedException();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/DataGridScopeView.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
29 |
30 |
32 |
33 |
35 |
36 |
38 |
39 |
41 |
42 |
43 |
44 |
45 |
48 |
49 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/DataGridScopeView.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System.Windows.Controls;
4 |
5 | public partial class DataGridScopeView : UserControl
6 | {
7 | public DataGridScopeView()
8 | {
9 | this.InitializeComponent();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/DataGridScopeVm.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System.Collections.ObjectModel;
4 |
5 | public class DataGridScopeVm
6 | {
7 | public ObservableCollection Collection { get; } = new()
8 | {
9 | new ViewModel(),
10 | new ViewModel(),
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/DataTemplatesView.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
35 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
49 |
52 |
53 |
56 |
60 |
61 |
64 |
68 |
69 |
70 |
71 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/DataTemplatesView.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System.Windows.Controls;
4 |
5 | public partial class DataTemplatesView : UserControl
6 | {
7 | public DataTemplatesView()
8 | {
9 | this.InitializeComponent();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/DynamicTypesView.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System;
4 | using System.Linq;
5 | using System.Windows.Controls;
6 |
7 | public partial class DynamicTypesView : UserControl
8 | {
9 | public DynamicTypesView()
10 | {
11 | this.InitializeComponent();
12 | }
13 |
14 | private void OnTypesListSelectionChanged(object _, SelectionChangedEventArgs __)
15 | {
16 | Scope.SetForInputTypes(this.Form, new InputTypeCollection(this.TypeListBox.SelectedItems.Cast()));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/Gu.Wpf.ValidationScope.Demo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net6.0-windows
5 | true
6 | latest
7 | Enable
8 |
9 |
10 |
11 | True
12 | AllEnabledByDefault
13 | latest
14 |
15 |
16 |
17 | true
18 | ..\Gu.Wpf.ValidationScope.snk
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/Gu.Wpf.ValidationScope.Demo.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/InputTypesView.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
33 |
34 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/InputTypesView.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System.Windows.Controls;
4 |
5 | public partial class InputTypesView : UserControl
6 | {
7 | public InputTypesView()
8 | {
9 | this.InitializeComponent();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System.Windows;
4 |
5 | ///
6 | /// Interaction logic for MainWindow.xaml.
7 | ///
8 | public partial class MainWindow : Window
9 | {
10 | public MainWindow()
11 | {
12 | this.InitializeComponent();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/NotifyDataErrorInfoView.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
34 |
39 |
40 |
43 |
48 |
49 |
52 |
57 |
58 |
61 |
66 |
67 |
68 |
69 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/NotifyDataErrorInfoView.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System.Windows.Controls;
4 |
5 | public partial class NotifyDataErrorInfoView : UserControl
6 | {
7 | public NotifyDataErrorInfoView()
8 | {
9 | this.InitializeComponent();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Gu.Wpf.ValidationScope.Demo/NotifyDataErrorInfoVm.cs:
--------------------------------------------------------------------------------
1 | namespace Gu.Wpf.ValidationScope.Demo;
2 |
3 | using System;
4 | using System.Collections;
5 | using System.ComponentModel;
6 | using System.Linq;
7 | using System.Runtime.CompilerServices;
8 |
9 | public class NotifyDataErrorInfoVm : INotifyPropertyChanged, INotifyDataErrorInfo
10 | {
11 | private int intValue1;
12 | private int intValue2;
13 |
14 | private string? error1;
15 |
16 | private string? error2;
17 |
18 | public event PropertyChangedEventHandler? PropertyChanged;
19 |
20 | public event EventHandler? ErrorsChanged;
21 |
22 | public bool HasErrors => !(string.IsNullOrEmpty(this.Error1) && string.IsNullOrEmpty(this.Error2));
23 |
24 | public int IntValue1
25 | {
26 | get => this.intValue1;
27 |
28 | set
29 | {
30 | if (value == this.intValue1)
31 | {
32 | return;
33 | }
34 |
35 | this.intValue1 = value;
36 | this.OnPropertyChanged();
37 | }
38 | }
39 |
40 | public string? Error1
41 | {
42 | get => this.error1;
43 |
44 | set
45 | {
46 | if (value == this.error1)
47 | {
48 | return;
49 | }
50 |
51 | this.error1 = value;
52 | this.OnPropertyChanged();
53 | this.OnPropertyChanged(nameof(this.HasErrors));
54 | this.OnErrorsChanged(nameof(this.IntValue1));
55 | }
56 | }
57 |
58 | public int IntValue2
59 | {
60 | get => this.intValue2;
61 |
62 | set
63 | {
64 | if (value == this.intValue2)
65 | {
66 | return;
67 | }
68 |
69 | this.intValue2 = value;
70 | this.OnPropertyChanged();
71 | }
72 | }
73 |
74 | public string? Error2
75 | {
76 | get => this.error2;
77 |
78 | set
79 | {
80 | if (value == this.error2)
81 | {
82 | return;
83 | }
84 |
85 | this.error2 = value;
86 | this.OnPropertyChanged();
87 | this.OnPropertyChanged(nameof(this.HasErrors));
88 | this.OnErrorsChanged(nameof(this.IntValue2));
89 | }
90 | }
91 |
92 | public IEnumerable GetErrors(string? propertyName)
93 | {
94 | if (propertyName == nameof(this.IntValue1))
95 | {
96 | return string.IsNullOrEmpty(this.error1)
97 | ? Enumerable.Empty()
98 | : new[] { this.Error1 };
99 | }
100 |
101 | if (propertyName == nameof(this.IntValue2))
102 | {
103 | return string.IsNullOrEmpty(this.error2)
104 | ? Enumerable.Empty()
105 | : new[] { this.Error2 };
106 | }
107 |
108 | return Enumerable.Empty