From b8717bf6dc433c6cacd66ac686d72a2abb1c50f1 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 14 Nov 2019 20:34:32 +0100 Subject: [PATCH] Tidy up API. --- src/Avalonia.Base/AvaloniaObject.cs | 56 +++++- src/Avalonia.Base/AvaloniaObjectExtensions.cs | 189 +++++++++++++++++- src/Avalonia.Base/AvaloniaProperty`1.cs | 5 - src/Avalonia.Base/DirectPropertyBase.cs | 10 +- src/Avalonia.Base/IAvaloniaObject.cs | 48 ++--- src/Avalonia.Base/StyledPropertyBase.cs | 6 + .../AvaloniaPropertyTests.cs | 5 + .../Data/BindingTests_TemplatedParent.cs | 12 +- .../SelectorTests_Child.cs | 40 ++++ .../SelectorTests_Descendent.cs | 40 ++++ .../Avalonia.Styling.UnitTests/SetterTests.cs | 12 +- .../TestControlBase.cs | 40 ++++ .../TestTemplatedControl.cs | 40 ++++ 13 files changed, 437 insertions(+), 66 deletions(-) diff --git a/src/Avalonia.Base/AvaloniaObject.cs b/src/Avalonia.Base/AvaloniaObject.cs index 0ce468354c..bcce2080a6 100644 --- a/src/Avalonia.Base/AvaloniaObject.cs +++ b/src/Avalonia.Base/AvaloniaObject.cs @@ -9,7 +9,6 @@ using Avalonia.Diagnostics; using Avalonia.Logging; using Avalonia.PropertyStore; using Avalonia.Threading; -using Avalonia.Utilities; namespace Avalonia { @@ -136,7 +135,8 @@ namespace Avalonia /// The property. public void ClearValue(AvaloniaProperty property) { - Contract.Requires(property != null); + property = property ?? throw new ArgumentNullException(nameof(property)); + property.RouteClearValue(this); } @@ -146,24 +146,47 @@ namespace Avalonia /// The property. public void ClearValue(AvaloniaProperty property) { + property = property ?? throw new ArgumentNullException(nameof(property)); VerifyAccess(); switch (property) { case StyledPropertyBase styled: - _values.ClearLocalValue(styled); + ClearValue(styled); break; case DirectPropertyBase direct: - var p = AvaloniaPropertyRegistry.Instance.GetRegisteredDirect(this, direct); - p.InvokeSetter(this, p.GetUnsetValue(GetType())); + ClearValue(direct); break; - case null: - throw new ArgumentNullException(nameof(property)); default: throw new NotSupportedException("Unsupported AvaloniaProperty type."); } } + /// + /// Clears a 's local value. + /// + /// The property. + public void ClearValue(StyledPropertyBase property) + { + property = property ?? throw new ArgumentNullException(nameof(property)); + VerifyAccess(); + + _values?.ClearLocalValue(property); + } + + /// + /// Clears a 's local value. + /// + /// The property. + public void ClearValue(DirectPropertyBase property) + { + property = property ?? throw new ArgumentNullException(nameof(property)); + VerifyAccess(); + + var p = AvaloniaPropertyRegistry.Instance.GetRegisteredDirect(this, property); + p.InvokeSetter(this, p.GetUnsetValue(GetType())); + } + /// /// Compares two objects using reference equality. /// @@ -202,6 +225,8 @@ namespace Avalonia /// The value. public object GetValue(AvaloniaProperty property) { + property = property ?? throw new ArgumentNullException(nameof(property)); + return property.RouteGetValue(this); } @@ -213,11 +238,12 @@ namespace Avalonia /// The value. public T GetValue(AvaloniaProperty property) { + property = property ?? throw new ArgumentNullException(nameof(property)); + return property switch { StyledPropertyBase styled => GetValue(styled), DirectPropertyBase direct => GetValue(direct), - null => throw new ArgumentNullException(nameof(property)), _ => throw new NotSupportedException("Unsupported AvaloniaProperty type.") }; } @@ -292,6 +318,8 @@ namespace Avalonia object value, BindingPriority priority = BindingPriority.LocalValue) { + property = property ?? throw new ArgumentNullException(nameof(property)); + property.RouteSetValue(this, value, priority); } @@ -307,6 +335,8 @@ namespace Avalonia T value, BindingPriority priority = BindingPriority.LocalValue) { + property = property ?? throw new ArgumentNullException(nameof(property)); + switch (property) { case StyledPropertyBase styled: @@ -315,8 +345,6 @@ namespace Avalonia case DirectPropertyBase direct: SetValue(direct, value); break; - case null: - throw new ArgumentNullException(nameof(property)); default: throw new NotSupportedException("Unsupported AvaloniaProperty type."); } @@ -386,6 +414,9 @@ namespace Avalonia IObservable> source, BindingPriority priority = BindingPriority.LocalValue) { + property = property ?? throw new ArgumentNullException(nameof(property)); + source = source ?? throw new ArgumentNullException(nameof(source)); + return property.RouteBind(this, source, priority); } @@ -404,11 +435,13 @@ namespace Avalonia IObservable> source, BindingPriority priority = BindingPriority.LocalValue) { + property = property ?? throw new ArgumentNullException(nameof(property)); + source = source ?? throw new ArgumentNullException(nameof(source)); + return property switch { StyledPropertyBase styled => Bind(styled, source, priority), DirectPropertyBase direct => Bind(direct, source), - null => throw new ArgumentNullException(nameof(property)), _ => throw new NotSupportedException("Unsupported AvaloniaProperty type."), }; } @@ -429,6 +462,7 @@ namespace Avalonia BindingPriority priority = BindingPriority.LocalValue) { property = property ?? throw new ArgumentNullException(nameof(property)); + source = source ?? throw new ArgumentNullException(nameof(source)); VerifyAccess(); return Values.AddBinding(property, source, priority); diff --git a/src/Avalonia.Base/AvaloniaObjectExtensions.cs b/src/Avalonia.Base/AvaloniaObjectExtensions.cs index 6a513231d5..a4c7fa95a5 100644 --- a/src/Avalonia.Base/AvaloniaObjectExtensions.cs +++ b/src/Avalonia.Base/AvaloniaObjectExtensions.cs @@ -125,7 +125,7 @@ namespace Avalonia /// for the specified property. /// public static IObservable GetPropertyChangedObservable( - this IAvaloniaObject o, + this IAvaloniaObject o, AvaloniaProperty property) { Contract.Requires(o != null); @@ -236,6 +236,58 @@ namespace Avalonia o.GetBindingObservable(property)); } + /// + /// Binds a to an observable. + /// + /// The object. + /// The property. + /// The observable. + /// The priority of the binding. + /// + /// A disposable which can be used to terminate the binding. + /// + public static IDisposable Bind( + this IAvaloniaObject target, + AvaloniaProperty property, + IObservable> source, + BindingPriority priority = BindingPriority.LocalValue) + { + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + source = source ?? throw new ArgumentNullException(nameof(source)); + + return property.RouteBind(target, source, priority); + } + + /// + /// Binds a to an observable. + /// + /// The type of the property. + /// The object. + /// The property. + /// The observable. + /// The priority of the binding. + /// + /// A disposable which can be used to terminate the binding. + /// + public static IDisposable Bind( + this IAvaloniaObject target, + AvaloniaProperty property, + IObservable> source, + BindingPriority priority = BindingPriority.LocalValue) + { + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + source = source ?? throw new ArgumentNullException(nameof(source)); + + return property switch + { + StyledPropertyBase styled => target.Bind(styled, source, priority), + DirectPropertyBase direct => target.Bind(direct, source), + _ => throw new NotSupportedException("Unsupported AvaloniaProperty type."), + }; + } + /// /// Binds a to an observable. /// @@ -252,6 +304,10 @@ namespace Avalonia IObservable source, BindingPriority priority = BindingPriority.LocalValue) { + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + source = source ?? throw new ArgumentNullException(nameof(source)); + return target.Bind( property, source.ToBindingValue(), @@ -274,6 +330,10 @@ namespace Avalonia IObservable source, BindingPriority priority = BindingPriority.LocalValue) { + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + source = source ?? throw new ArgumentNullException(nameof(source)); + return target.Bind( property, source.ToBindingValue(), @@ -299,16 +359,16 @@ namespace Avalonia IBinding binding, object anchor = null) { - Contract.Requires(target != null); - Contract.Requires(property != null); - Contract.Requires(binding != null); + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + binding = binding ?? throw new ArgumentNullException(nameof(binding)); var metadata = property.GetMetadata(target.GetType()) as IDirectPropertyMetadata; var result = binding.Initiate( target, property, - anchor, + anchor, metadata?.EnableDataValidation ?? false); if (result != null) @@ -321,6 +381,125 @@ namespace Avalonia } } + /// + /// Clears a 's local value. + /// + /// The object. + /// The property. + public static void ClearValue(this IAvaloniaObject target, AvaloniaProperty property) + { + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + + property.RouteClearValue(target); + } + + /// + /// Clears a 's local value. + /// + /// The object. + /// The property. + public static void ClearValue(this IAvaloniaObject target, AvaloniaProperty property) + { + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + + switch (property) + { + case StyledPropertyBase styled: + target.ClearValue(styled); + break; + case DirectPropertyBase direct: + target.ClearValue(direct); + break; + default: + throw new NotSupportedException("Unsupported AvaloniaProperty type."); + } + } + + /// + /// Gets a value. + /// + /// The object. + /// The property. + /// The value. + public static object GetValue(this IAvaloniaObject target, AvaloniaProperty property) + { + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + + return property.RouteGetValue(target); + } + + /// + /// Gets a value. + /// + /// The type of the property. + /// The object. + /// The property. + /// The value. + public static T GetValue(this IAvaloniaObject target, AvaloniaProperty property) + { + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + + return property switch + { + StyledPropertyBase styled => target.GetValue(styled), + DirectPropertyBase direct => target.GetValue(direct), + _ => throw new NotSupportedException("Unsupported AvaloniaProperty type.") + }; + } + + /// + /// Sets a value. + /// + /// The object. + /// The property. + /// The value. + /// The priority of the value. + public static void SetValue( + this IAvaloniaObject target, + AvaloniaProperty property, + object value, + BindingPriority priority = BindingPriority.LocalValue) + { + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + + property.RouteSetValue(target, value, priority); + } + + /// + /// Sets a value. + /// + /// The type of the property. + /// The object. + /// The property. + /// The value. + /// The priority of the value. + public static void SetValue( + this IAvaloniaObject target, + AvaloniaProperty property, + T value, + BindingPriority priority = BindingPriority.LocalValue) + { + target = target ?? throw new ArgumentNullException(nameof(target)); + property = property ?? throw new ArgumentNullException(nameof(property)); + + switch (property) + { + case StyledPropertyBase styled: + target.SetValue(styled, value, priority); + break; + case DirectPropertyBase direct: + target.SetValue(direct, value); + break; + default: + throw new NotSupportedException("Unsupported AvaloniaProperty type."); + } + } + /// /// Subscribes to a property changed notifications for changes that originate from a /// . diff --git a/src/Avalonia.Base/AvaloniaProperty`1.cs b/src/Avalonia.Base/AvaloniaProperty`1.cs index 566a153135..be58ff796d 100644 --- a/src/Avalonia.Base/AvaloniaProperty`1.cs +++ b/src/Avalonia.Base/AvaloniaProperty`1.cs @@ -43,11 +43,6 @@ namespace Avalonia { } - internal override void RouteClearValue(IAvaloniaObject o) - { - o.ClearValue(this); - } - protected BindingValue TryConvert(object value) { if (value == UnsetValue) diff --git a/src/Avalonia.Base/DirectPropertyBase.cs b/src/Avalonia.Base/DirectPropertyBase.cs index a7d3f114bb..7a0be065eb 100644 --- a/src/Avalonia.Base/DirectPropertyBase.cs +++ b/src/Avalonia.Base/DirectPropertyBase.cs @@ -116,6 +116,12 @@ namespace Avalonia } } + /// + internal override void RouteClearValue(IAvaloniaObject o) + { + o.ClearValue(this); + } + /// internal override object? RouteGetValue(IAvaloniaObject o) { @@ -132,7 +138,7 @@ namespace Avalonia if (v.HasValue) { - o.SetValue(this, (TValue)v.Value, priority); + o.SetValue(this, (TValue)v.Value); } else if (v.Type == BindingValueType.UnsetValue) { @@ -151,7 +157,7 @@ namespace Avalonia BindingPriority priority) { var adapter = TypedBindingAdapter.Create(o, this, source); - return o.Bind(this, adapter, priority); + return o.Bind(this, adapter); } internal override void RouteInheritanceParentChanged(AvaloniaObject o, IAvaloniaObject oldParent) diff --git a/src/Avalonia.Base/IAvaloniaObject.cs b/src/Avalonia.Base/IAvaloniaObject.cs index 066f9121eb..4fec3d71af 100644 --- a/src/Avalonia.Base/IAvaloniaObject.cs +++ b/src/Avalonia.Base/IAvaloniaObject.cs @@ -17,23 +17,24 @@ namespace Avalonia event EventHandler PropertyChanged; /// - /// Clears a 's local value. + /// Clears an 's local value. /// /// The property. - public void ClearValue(AvaloniaProperty property); + void ClearValue(StyledPropertyBase property); /// - /// Clears a 's local value. + /// Clears an 's local value. /// /// The property. - public void ClearValue(AvaloniaProperty property); + void ClearValue(DirectPropertyBase property); /// /// Gets a value. /// + /// The type of the property. /// The property. /// The value. - object GetValue(AvaloniaProperty property); + T GetValue(StyledPropertyBase property); /// /// Gets a value. @@ -41,7 +42,7 @@ namespace Avalonia /// The type of the property. /// The property. /// The value. - T GetValue(AvaloniaProperty property); + T GetValue(DirectPropertyBase property); /// /// Checks whether a is animating. @@ -60,12 +61,13 @@ namespace Avalonia /// /// Sets a value. /// + /// The type of the property. /// The property. /// The value. /// The priority of the value. - void SetValue( - AvaloniaProperty property, - object value, + void SetValue( + StyledPropertyBase property, + T value, BindingPriority priority = BindingPriority.LocalValue); /// @@ -74,24 +76,21 @@ namespace Avalonia /// The type of the property. /// The property. /// The value. - /// The priority of the value. - void SetValue( - AvaloniaProperty property, - T value, - BindingPriority priority = BindingPriority.LocalValue); + void SetValue(DirectPropertyBase property, T value); /// /// Binds a to an observable. /// + /// The type of the property. /// The property. /// The observable. /// The priority of the binding. /// /// A disposable which can be used to terminate the binding. /// - IDisposable Bind( - AvaloniaProperty property, - IObservable> source, + IDisposable Bind( + StyledPropertyBase property, + IObservable> source, BindingPriority priority = BindingPriority.LocalValue); /// @@ -100,14 +99,12 @@ namespace Avalonia /// The type of the property. /// The property. /// The observable. - /// The priority of the binding. /// /// A disposable which can be used to terminate the binding. /// IDisposable Bind( - AvaloniaProperty property, - IObservable> source, - BindingPriority priority = BindingPriority.LocalValue); + DirectPropertyBase property, + IObservable> source); /// /// Registers an object as an inheritance child. @@ -130,19 +127,14 @@ namespace Avalonia /// void RemoveInheritanceChild(IAvaloniaObject child); - //void InheritanceParentChanged( - // StyledPropertyBase property, - // IAvaloniaObject oldParent, - // IAvaloniaObject newParent); - /// /// Called when an inheritable property changes on an object registered as an inheritance /// parent. /// /// The type of the value. /// The property that has changed. - /// The old property value. - /// The new property value. + /// + /// void InheritedPropertyChanged( AvaloniaProperty property, Optional oldValue, diff --git a/src/Avalonia.Base/StyledPropertyBase.cs b/src/Avalonia.Base/StyledPropertyBase.cs index d842638e57..129b1f3c12 100644 --- a/src/Avalonia.Base/StyledPropertyBase.cs +++ b/src/Avalonia.Base/StyledPropertyBase.cs @@ -153,6 +153,12 @@ namespace Avalonia } } + /// + internal override void RouteClearValue(IAvaloniaObject o) + { + o.ClearValue(this); + } + /// internal override object RouteGetValue(IAvaloniaObject o) { diff --git a/tests/Avalonia.Base.UnitTests/AvaloniaPropertyTests.cs b/tests/Avalonia.Base.UnitTests/AvaloniaPropertyTests.cs index 13c35814ee..90b8bcff63 100644 --- a/tests/Avalonia.Base.UnitTests/AvaloniaPropertyTests.cs +++ b/tests/Avalonia.Base.UnitTests/AvaloniaPropertyTests.cs @@ -154,6 +154,11 @@ namespace Avalonia.Base.UnitTests throw new NotImplementedException(); } + internal override void RouteClearValue(IAvaloniaObject o) + { + throw new NotImplementedException(); + } + internal override object RouteGetValue(IAvaloniaObject o) { throw new NotImplementedException(); diff --git a/tests/Avalonia.Markup.UnitTests/Data/BindingTests_TemplatedParent.cs b/tests/Avalonia.Markup.UnitTests/Data/BindingTests_TemplatedParent.cs index 237ed58de5..b8885369bb 100644 --- a/tests/Avalonia.Markup.UnitTests/Data/BindingTests_TemplatedParent.cs +++ b/tests/Avalonia.Markup.UnitTests/Data/BindingTests_TemplatedParent.cs @@ -35,8 +35,7 @@ namespace Avalonia.Markup.UnitTests.Data target.Verify(x => x.Bind( TextBox.TextProperty, - It.IsAny>>(), - BindingPriority.TemplatedParent)); + It.IsAny>>())); } [Fact] @@ -55,8 +54,7 @@ namespace Avalonia.Markup.UnitTests.Data target.Verify(x => x.Bind( TextBox.TextProperty, - It.IsAny>>(), - BindingPriority.TemplatedParent)); + It.IsAny>>())); } private Mock CreateTarget( @@ -66,9 +64,9 @@ namespace Avalonia.Markup.UnitTests.Data var result = new Mock(); result.Setup(x => x.GetValue(Control.TemplatedParentProperty)).Returns(templatedParent); - result.Setup(x => x.GetValue((AvaloniaProperty)Control.TemplatedParentProperty)).Returns(templatedParent); - result.Setup(x => x.GetValue((AvaloniaProperty)TextBox.TextProperty)).Returns(text); - result.Setup(x => x.Bind(It.IsAny(), It.IsAny>>(), It.IsAny())) + result.Setup(x => x.GetValue(Control.TemplatedParentProperty)).Returns(templatedParent); + result.Setup(x => x.GetValue(TextBox.TextProperty)).Returns(text); + result.Setup(x => x.Bind(It.IsAny>(), It.IsAny>>())) .Returns(Disposable.Empty); return result; } diff --git a/tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs b/tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs index 30a72535dc..6e9447fff1 100644 --- a/tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs +++ b/tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs @@ -195,6 +195,46 @@ namespace Avalonia.Styling.UnitTests { throw new NotImplementedException(); } + + public void ClearValue(StyledPropertyBase property) + { + throw new NotImplementedException(); + } + + public void ClearValue(DirectPropertyBase property) + { + throw new NotImplementedException(); + } + + public T GetValue(StyledPropertyBase property) + { + throw new NotImplementedException(); + } + + public T GetValue(DirectPropertyBase property) + { + throw new NotImplementedException(); + } + + public void SetValue(StyledPropertyBase property, T value, BindingPriority priority = BindingPriority.LocalValue) + { + throw new NotImplementedException(); + } + + public void SetValue(DirectPropertyBase property, T value) + { + throw new NotImplementedException(); + } + + public IDisposable Bind(StyledPropertyBase property, IObservable> source, BindingPriority priority = BindingPriority.LocalValue) + { + throw new NotImplementedException(); + } + + public IDisposable Bind(DirectPropertyBase property, IObservable> source) + { + throw new NotImplementedException(); + } } public class TestLogical1 : TestLogical diff --git a/tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs b/tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs index 56c308cdc7..f64a3010c4 100644 --- a/tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs +++ b/tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs @@ -225,6 +225,46 @@ namespace Avalonia.Styling.UnitTests { throw new NotImplementedException(); } + + public void ClearValue(StyledPropertyBase property) + { + throw new NotImplementedException(); + } + + public void ClearValue(DirectPropertyBase property) + { + throw new NotImplementedException(); + } + + public T GetValue(StyledPropertyBase property) + { + throw new NotImplementedException(); + } + + public T GetValue(DirectPropertyBase property) + { + throw new NotImplementedException(); + } + + public void SetValue(StyledPropertyBase property, T value, BindingPriority priority = BindingPriority.LocalValue) + { + throw new NotImplementedException(); + } + + public void SetValue(DirectPropertyBase property, T value) + { + throw new NotImplementedException(); + } + + public IDisposable Bind(StyledPropertyBase property, IObservable> source, BindingPriority priority = BindingPriority.LocalValue) + { + throw new NotImplementedException(); + } + + public IDisposable Bind(DirectPropertyBase property, IObservable> source) + { + throw new NotImplementedException(); + } } public class TestLogical1 : TestLogical diff --git a/tests/Avalonia.Styling.UnitTests/SetterTests.cs b/tests/Avalonia.Styling.UnitTests/SetterTests.cs index 4c8ea7753b..7f63f2b05a 100644 --- a/tests/Avalonia.Styling.UnitTests/SetterTests.cs +++ b/tests/Avalonia.Styling.UnitTests/SetterTests.cs @@ -83,8 +83,7 @@ namespace Avalonia.Styling.UnitTests control.Verify(x => x.Bind( TextBlock.TextProperty, - It.IsAny>>(), - BindingPriority.Style)); + It.IsAny>>())); } [Fact] @@ -99,8 +98,7 @@ namespace Avalonia.Styling.UnitTests control.Verify(x => x.Bind( TextBlock.TextProperty, - It.IsAny>>(), - BindingPriority.StyleTrigger)); + It.IsAny>>())); } [Fact] @@ -114,8 +112,7 @@ namespace Avalonia.Styling.UnitTests control.Verify(x => x.Bind( TextBlock.TextProperty, - It.IsAny>>(), - BindingPriority.Style)); + It.IsAny>>())); } [Fact] @@ -130,8 +127,7 @@ namespace Avalonia.Styling.UnitTests control.Verify(x => x.Bind( TextBlock.TextProperty, - It.IsAny>>(), - BindingPriority.StyleTrigger)); + It.IsAny>>())); } private IBinding CreateMockBinding(AvaloniaProperty property) diff --git a/tests/Avalonia.Styling.UnitTests/TestControlBase.cs b/tests/Avalonia.Styling.UnitTests/TestControlBase.cs index 89d6e6d5d3..4bc7baa4db 100644 --- a/tests/Avalonia.Styling.UnitTests/TestControlBase.cs +++ b/tests/Avalonia.Styling.UnitTests/TestControlBase.cs @@ -109,5 +109,45 @@ namespace Avalonia.Styling.UnitTests { throw new NotImplementedException(); } + + public void ClearValue(StyledPropertyBase property) + { + throw new NotImplementedException(); + } + + public void ClearValue(DirectPropertyBase property) + { + throw new NotImplementedException(); + } + + public T GetValue(StyledPropertyBase property) + { + throw new NotImplementedException(); + } + + public T GetValue(DirectPropertyBase property) + { + throw new NotImplementedException(); + } + + public void SetValue(StyledPropertyBase property, T value, BindingPriority priority = BindingPriority.LocalValue) + { + throw new NotImplementedException(); + } + + public void SetValue(DirectPropertyBase property, T value) + { + throw new NotImplementedException(); + } + + public IDisposable Bind(StyledPropertyBase property, IObservable> source, BindingPriority priority = BindingPriority.LocalValue) + { + throw new NotImplementedException(); + } + + public IDisposable Bind(DirectPropertyBase property, IObservable> source) + { + throw new NotImplementedException(); + } } } diff --git a/tests/Avalonia.Styling.UnitTests/TestTemplatedControl.cs b/tests/Avalonia.Styling.UnitTests/TestTemplatedControl.cs index c15950454c..58d1a57bdf 100644 --- a/tests/Avalonia.Styling.UnitTests/TestTemplatedControl.cs +++ b/tests/Avalonia.Styling.UnitTests/TestTemplatedControl.cs @@ -107,5 +107,45 @@ namespace Avalonia.Styling.UnitTests { throw new NotImplementedException(); } + + public void ClearValue(StyledPropertyBase property) + { + throw new NotImplementedException(); + } + + public void ClearValue(DirectPropertyBase property) + { + throw new NotImplementedException(); + } + + public T GetValue(StyledPropertyBase property) + { + throw new NotImplementedException(); + } + + public T GetValue(DirectPropertyBase property) + { + throw new NotImplementedException(); + } + + public void SetValue(StyledPropertyBase property, T value, BindingPriority priority = BindingPriority.LocalValue) + { + throw new NotImplementedException(); + } + + public void SetValue(DirectPropertyBase property, T value) + { + throw new NotImplementedException(); + } + + public IDisposable Bind(StyledPropertyBase property, IObservable> source, BindingPriority priority = BindingPriority.LocalValue) + { + throw new NotImplementedException(); + } + + public IDisposable Bind(DirectPropertyBase property, IObservable> source) + { + throw new NotImplementedException(); + } } }