Browse Source

Remove ignored validate parameter.

pull/3258/head
Steven Kirk 7 years ago
parent
commit
0cfa15913d
  1. 6
      src/Avalonia.Base/AvaloniaProperty.cs
  2. 4
      src/Avalonia.Controls/DefinitionBase.cs
  3. 16
      src/Avalonia.Controls/Grid.cs
  4. 4
      src/Avalonia.Controls/NativeMenu.Export.cs
  5. 2
      src/Avalonia.Controls/Notifications/NotificationCard.cs
  6. 13
      tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs

6
src/Avalonia.Base/AvaloniaProperty.cs

@ -302,8 +302,7 @@ namespace Avalonia
string name, string name,
TValue defaultValue = default(TValue), TValue defaultValue = default(TValue),
bool inherits = false, bool inherits = false,
BindingMode defaultBindingMode = BindingMode.OneWay, BindingMode defaultBindingMode = BindingMode.OneWay)
Func<THost, TValue, TValue> validate = null)
where THost : IAvaloniaObject where THost : IAvaloniaObject
{ {
Contract.Requires<ArgumentNullException>(name != null); Contract.Requires<ArgumentNullException>(name != null);
@ -335,8 +334,7 @@ namespace Avalonia
Type ownerType, Type ownerType,
TValue defaultValue = default(TValue), TValue defaultValue = default(TValue),
bool inherits = false, bool inherits = false,
BindingMode defaultBindingMode = BindingMode.OneWay, BindingMode defaultBindingMode = BindingMode.OneWay)
Func<THost, TValue, TValue> validate = null)
where THost : IAvaloniaObject where THost : IAvaloniaObject
{ {
Contract.Requires<ArgumentNullException>(name != null); Contract.Requires<ArgumentNullException>(name != null);

4
src/Avalonia.Controls/DefinitionBase.cs

@ -750,8 +750,8 @@ namespace Avalonia.Controls
/// </remarks> /// </remarks>
public static readonly AttachedProperty<string> SharedSizeGroupProperty = public static readonly AttachedProperty<string> SharedSizeGroupProperty =
AvaloniaProperty.RegisterAttached<DefinitionBase, Control, string>( AvaloniaProperty.RegisterAttached<DefinitionBase, Control, string>(
"SharedSizeGroup", "SharedSizeGroup"/*,
validate: SharedSizeGroupPropertyValueValid); validate: SharedSizeGroupPropertyValueValid*/);
/// <summary> /// <summary>
/// Static ctor. Used for static registration of properties. /// Static ctor. Used for static registration of properties.

16
src/Avalonia.Controls/Grid.cs

@ -2740,12 +2740,12 @@ namespace Avalonia.Controls
public static readonly AttachedProperty<int> ColumnProperty = public static readonly AttachedProperty<int> ColumnProperty =
AvaloniaProperty.RegisterAttached<Grid, Control, int>( AvaloniaProperty.RegisterAttached<Grid, Control, int>(
"Column", "Column",
defaultValue: 0, defaultValue: 0/*,
validate: (_, v) => validate: (_, v) =>
{ {
if (v >= 0) return v; if (v >= 0) return v;
else throw new ArgumentException("Invalid Grid.Column value."); else throw new ArgumentException("Invalid Grid.Column value.");
}); }*/);
/// <summary> /// <summary>
/// Row property. This is an attached property. /// Row property. This is an attached property.
@ -2761,12 +2761,12 @@ namespace Avalonia.Controls
public static readonly AttachedProperty<int> RowProperty = public static readonly AttachedProperty<int> RowProperty =
AvaloniaProperty.RegisterAttached<Grid, Control, int>( AvaloniaProperty.RegisterAttached<Grid, Control, int>(
"Row", "Row",
defaultValue: 0, defaultValue: 0/*,
validate: (_, v) => validate: (_, v) =>
{ {
if (v >= 0) return v; if (v >= 0) return v;
else throw new ArgumentException("Invalid Grid.Row value."); else throw new ArgumentException("Invalid Grid.Row value.");
}); }*/);
/// <summary> /// <summary>
/// ColumnSpan property. This is an attached property. /// ColumnSpan property. This is an attached property.
@ -2781,12 +2781,12 @@ namespace Avalonia.Controls
public static readonly AttachedProperty<int> ColumnSpanProperty = public static readonly AttachedProperty<int> ColumnSpanProperty =
AvaloniaProperty.RegisterAttached<Grid, Control, int>( AvaloniaProperty.RegisterAttached<Grid, Control, int>(
"ColumnSpan", "ColumnSpan",
defaultValue: 1, defaultValue: 1/*,
validate: (_, v) => validate: (_, v) =>
{ {
if (v >= 1) return v; if (v >= 1) return v;
else throw new ArgumentException("Invalid Grid.ColumnSpan value."); else throw new ArgumentException("Invalid Grid.ColumnSpan value.");
}); }*/);
/// <summary> /// <summary>
/// RowSpan property. This is an attached property. /// RowSpan property. This is an attached property.
@ -2801,12 +2801,12 @@ namespace Avalonia.Controls
public static readonly AttachedProperty<int> RowSpanProperty = public static readonly AttachedProperty<int> RowSpanProperty =
AvaloniaProperty.RegisterAttached<Grid, Control, int>( AvaloniaProperty.RegisterAttached<Grid, Control, int>(
"RowSpan", "RowSpan",
defaultValue: 1, defaultValue: 1/*,
validate: (_, v) => validate: (_, v) =>
{ {
if (v >= 1) return v; if (v >= 1) return v;
else throw new ArgumentException("Invalid Grid.RowSpan value."); else throw new ArgumentException("Invalid Grid.RowSpan value.");
}); }*/);
/// <summary> /// <summary>
/// IsSharedSizeScope property marks scoping element for shared size. /// IsSharedSizeScope property marks scoping element for shared size.

4
src/Avalonia.Controls/NativeMenu.Export.cs

@ -52,13 +52,13 @@ namespace Avalonia.Controls
} }
public static readonly AttachedProperty<NativeMenu> MenuProperty public static readonly AttachedProperty<NativeMenu> MenuProperty
= AvaloniaProperty.RegisterAttached<NativeMenu, AvaloniaObject, NativeMenu>("Menu", validate: = AvaloniaProperty.RegisterAttached<NativeMenu, AvaloniaObject, NativeMenu>("Menu"/*, validate:
(o, v) => (o, v) =>
{ {
if(!(o is Application || o is TopLevel)) if(!(o is Application || o is TopLevel))
throw new InvalidOperationException("NativeMenu.Menu property isn't valid on "+o.GetType()); throw new InvalidOperationException("NativeMenu.Menu property isn't valid on "+o.GetType());
return v; return v;
}); }*/);
public static void SetMenu(AvaloniaObject o, NativeMenu menu) => o.SetValue(MenuProperty, menu); public static void SetMenu(AvaloniaObject o, NativeMenu menu) => o.SetValue(MenuProperty, menu);
public static NativeMenu GetMenu(AvaloniaObject o) => o.GetValue(MenuProperty); public static NativeMenu GetMenu(AvaloniaObject o) => o.GetValue(MenuProperty);

2
src/Avalonia.Controls/Notifications/NotificationCard.cs

@ -118,7 +118,7 @@ namespace Avalonia.Controls.Notifications
/// Defines the CloseOnClick property. /// Defines the CloseOnClick property.
/// </summary> /// </summary>
public static readonly AvaloniaProperty CloseOnClickProperty = public static readonly AvaloniaProperty CloseOnClickProperty =
AvaloniaProperty.RegisterAttached<Button, bool>("CloseOnClick", typeof(NotificationCard), validate: CloseOnClickChanged); AvaloniaProperty.RegisterAttached<Button, bool>("CloseOnClick", typeof(NotificationCard)/*, validate: CloseOnClickChanged*/);
private static bool CloseOnClickChanged(Button button, bool value) private static bool CloseOnClickChanged(Button button, bool value)
{ {

13
tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Attached.cs

@ -38,18 +38,7 @@ namespace Avalonia.Base.UnitTests
public static readonly AttachedProperty<string> FooProperty = public static readonly AttachedProperty<string> FooProperty =
AvaloniaProperty.RegisterAttached<Class1, Base, string>( AvaloniaProperty.RegisterAttached<Class1, Base, string>(
"Foo", "Foo",
"foodefault", "foodefault");
validate: ValidateFoo);
private static string ValidateFoo(AvaloniaObject arg1, string arg2)
{
if (arg2 == "throw")
{
throw new IndexOutOfRangeException();
}
return arg2;
}
} }
private class Class2 : Base private class Class2 : Base

Loading…
Cancel
Save