diff --git a/src/Avalonia.Base/AvaloniaProperty.cs b/src/Avalonia.Base/AvaloniaProperty.cs index 1bda55285e1..a39b8e6e1df 100644 --- a/src/Avalonia.Base/AvaloniaProperty.cs +++ b/src/Avalonia.Base/AvaloniaProperty.cs @@ -302,8 +302,7 @@ public static AttachedProperty RegisterAttached( 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 @@ public static AttachedProperty RegisterAttached( 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 e4ae7774534..eae6cf5e305 100644 --- a/src/Avalonia.Controls/DefinitionBase.cs +++ b/src/Avalonia.Controls/DefinitionBase.cs @@ -750,8 +750,8 @@ private void OnLayoutUpdated(object sender, EventArgs e) /// 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 23c1cd47946..7b57288e760 100644 --- a/src/Avalonia.Controls/Grid.cs +++ b/src/Avalonia.Controls/Grid.cs @@ -2740,12 +2740,12 @@ private enum Flags 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 @@ private enum Flags 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 @@ private enum Flags 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 @@ private enum Flags 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 5d3a4526cc8..776e9d2171f 100644 --- a/src/Avalonia.Controls/NativeMenu.Export.cs +++ b/src/Avalonia.Controls/NativeMenu.Export.cs @@ -52,13 +52,13 @@ static void SetIsNativeMenuExported(TopLevel tl, bool value) } 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 7f69afaeeb6..9e9eeec7c53 100644 --- a/src/Avalonia.Controls/Notifications/NotificationCard.cs +++ b/src/Avalonia.Controls/Notifications/NotificationCard.cs @@ -118,7 +118,7 @@ public static void SetCloseOnClick(Button obj, bool value) /// 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 3cf308f7be1..44e2976e038 100644 --- a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs +++ b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs @@ -38,18 +38,7 @@ private class Class1 : Base 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