diff --git a/src/Avalonia.Base/AvaloniaProperty.cs b/src/Avalonia.Base/AvaloniaProperty.cs index 1bda55285e..a39b8e6e1d 100644 --- a/src/Avalonia.Base/AvaloniaProperty.cs +++ b/src/Avalonia.Base/AvaloniaProperty.cs @@ -302,8 +302,7 @@ namespace Avalonia string name, TValue defaultValue = default(TValue), bool inherits = false, - BindingMode defaultBindingMode = BindingMode.OneWay, - Func validate = null) + BindingMode defaultBindingMode = BindingMode.OneWay) where THost : IAvaloniaObject { Contract.Requires(name != null); @@ -335,8 +334,7 @@ namespace Avalonia Type ownerType, TValue defaultValue = default(TValue), bool inherits = false, - BindingMode defaultBindingMode = BindingMode.OneWay, - Func validate = null) + BindingMode defaultBindingMode = BindingMode.OneWay) where THost : IAvaloniaObject { Contract.Requires(name != null); diff --git a/src/Avalonia.Controls/DefinitionBase.cs b/src/Avalonia.Controls/DefinitionBase.cs index e4ae777453..eae6cf5e30 100644 --- a/src/Avalonia.Controls/DefinitionBase.cs +++ b/src/Avalonia.Controls/DefinitionBase.cs @@ -750,8 +750,8 @@ namespace Avalonia.Controls /// public static readonly AttachedProperty SharedSizeGroupProperty = AvaloniaProperty.RegisterAttached( - "SharedSizeGroup", - validate: SharedSizeGroupPropertyValueValid); + "SharedSizeGroup"/*, + validate: SharedSizeGroupPropertyValueValid*/); /// /// Static ctor. Used for static registration of properties. diff --git a/src/Avalonia.Controls/Grid.cs b/src/Avalonia.Controls/Grid.cs index 23c1cd4794..7b57288e76 100644 --- a/src/Avalonia.Controls/Grid.cs +++ b/src/Avalonia.Controls/Grid.cs @@ -2740,12 +2740,12 @@ namespace Avalonia.Controls public static readonly AttachedProperty ColumnProperty = AvaloniaProperty.RegisterAttached( "Column", - defaultValue: 0, + defaultValue: 0/*, validate: (_, v) => { if (v >= 0) return v; else throw new ArgumentException("Invalid Grid.Column value."); - }); + }*/); /// /// Row property. This is an attached property. @@ -2761,12 +2761,12 @@ namespace Avalonia.Controls public static readonly AttachedProperty RowProperty = AvaloniaProperty.RegisterAttached( "Row", - defaultValue: 0, + defaultValue: 0/*, validate: (_, v) => { if (v >= 0) return v; else throw new ArgumentException("Invalid Grid.Row value."); - }); + }*/); /// /// ColumnSpan property. This is an attached property. @@ -2781,12 +2781,12 @@ namespace Avalonia.Controls public static readonly AttachedProperty ColumnSpanProperty = AvaloniaProperty.RegisterAttached( "ColumnSpan", - defaultValue: 1, + defaultValue: 1/*, validate: (_, v) => { if (v >= 1) return v; else throw new ArgumentException("Invalid Grid.ColumnSpan value."); - }); + }*/); /// /// RowSpan property. This is an attached property. @@ -2801,12 +2801,12 @@ namespace Avalonia.Controls public static readonly AttachedProperty RowSpanProperty = AvaloniaProperty.RegisterAttached( "RowSpan", - defaultValue: 1, + defaultValue: 1/*, validate: (_, v) => { if (v >= 1) return v; else throw new ArgumentException("Invalid Grid.RowSpan value."); - }); + }*/); /// /// IsSharedSizeScope property marks scoping element for shared size. diff --git a/src/Avalonia.Controls/NativeMenu.Export.cs b/src/Avalonia.Controls/NativeMenu.Export.cs index 5d3a4526cc..776e9d2171 100644 --- a/src/Avalonia.Controls/NativeMenu.Export.cs +++ b/src/Avalonia.Controls/NativeMenu.Export.cs @@ -52,13 +52,13 @@ namespace Avalonia.Controls } public static readonly AttachedProperty MenuProperty - = AvaloniaProperty.RegisterAttached("Menu", validate: + = AvaloniaProperty.RegisterAttached("Menu"/*, validate: (o, v) => { if(!(o is Application || o is TopLevel)) throw new InvalidOperationException("NativeMenu.Menu property isn't valid on "+o.GetType()); return v; - }); + }*/); public static void SetMenu(AvaloniaObject o, NativeMenu menu) => o.SetValue(MenuProperty, menu); public static NativeMenu GetMenu(AvaloniaObject o) => o.GetValue(MenuProperty); diff --git a/src/Avalonia.Controls/Notifications/NotificationCard.cs b/src/Avalonia.Controls/Notifications/NotificationCard.cs index 7f69afaeeb..9e9eeec7c5 100644 --- a/src/Avalonia.Controls/Notifications/NotificationCard.cs +++ b/src/Avalonia.Controls/Notifications/NotificationCard.cs @@ -118,7 +118,7 @@ namespace Avalonia.Controls.Notifications /// Defines the CloseOnClick property. /// public static readonly AvaloniaProperty CloseOnClickProperty = - AvaloniaProperty.RegisterAttached("CloseOnClick", typeof(NotificationCard), validate: CloseOnClickChanged); + AvaloniaProperty.RegisterAttached("CloseOnClick", typeof(NotificationCard)/*, validate: CloseOnClickChanged*/); private static bool CloseOnClickChanged(Button button, bool value) { diff --git a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs index 3cf308f7be..44e2976e03 100644 --- a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs +++ b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs @@ -38,18 +38,7 @@ namespace Avalonia.Base.UnitTests public static readonly AttachedProperty FooProperty = AvaloniaProperty.RegisterAttached( "Foo", - "foodefault", - validate: ValidateFoo); - - private static string ValidateFoo(AvaloniaObject arg1, string arg2) - { - if (arg2 == "throw") - { - throw new IndexOutOfRangeException(); - } - - return arg2; - } + "foodefault"); } private class Class2 : Base