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

4
src/Avalonia.Controls/DefinitionBase.cs

@ -750,8 +750,8 @@ namespace Avalonia.Controls
/// </remarks>
public static readonly AttachedProperty<string> SharedSizeGroupProperty =
AvaloniaProperty.RegisterAttached<DefinitionBase, Control, string>(
"SharedSizeGroup",
validate: SharedSizeGroupPropertyValueValid);
"SharedSizeGroup"/*,
validate: SharedSizeGroupPropertyValueValid*/);
/// <summary>
/// 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 =
AvaloniaProperty.RegisterAttached<Grid, Control, int>(
"Column",
defaultValue: 0,
defaultValue: 0/*,
validate: (_, v) =>
{
if (v >= 0) return v;
else throw new ArgumentException("Invalid Grid.Column value.");
});
}*/);
/// <summary>
/// Row property. This is an attached property.
@ -2761,12 +2761,12 @@ namespace Avalonia.Controls
public static readonly AttachedProperty<int> RowProperty =
AvaloniaProperty.RegisterAttached<Grid, Control, int>(
"Row",
defaultValue: 0,
defaultValue: 0/*,
validate: (_, v) =>
{
if (v >= 0) return v;
else throw new ArgumentException("Invalid Grid.Row value.");
});
}*/);
/// <summary>
/// ColumnSpan property. This is an attached property.
@ -2781,12 +2781,12 @@ namespace Avalonia.Controls
public static readonly AttachedProperty<int> ColumnSpanProperty =
AvaloniaProperty.RegisterAttached<Grid, Control, int>(
"ColumnSpan",
defaultValue: 1,
defaultValue: 1/*,
validate: (_, v) =>
{
if (v >= 1) return v;
else throw new ArgumentException("Invalid Grid.ColumnSpan value.");
});
}*/);
/// <summary>
/// RowSpan property. This is an attached property.
@ -2801,12 +2801,12 @@ namespace Avalonia.Controls
public static readonly AttachedProperty<int> RowSpanProperty =
AvaloniaProperty.RegisterAttached<Grid, Control, int>(
"RowSpan",
defaultValue: 1,
defaultValue: 1/*,
validate: (_, v) =>
{
if (v >= 1) return v;
else throw new ArgumentException("Invalid Grid.RowSpan value.");
});
}*/);
/// <summary>
/// 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
= AvaloniaProperty.RegisterAttached<NativeMenu, AvaloniaObject, NativeMenu>("Menu", validate:
= AvaloniaProperty.RegisterAttached<NativeMenu, AvaloniaObject, NativeMenu>("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);

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

@ -118,7 +118,7 @@ namespace Avalonia.Controls.Notifications
/// Defines the CloseOnClick property.
/// </summary>
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)
{

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

@ -38,18 +38,7 @@ namespace Avalonia.Base.UnitTests
public static readonly AttachedProperty<string> FooProperty =
AvaloniaProperty.RegisterAttached<Class1, Base, string>(
"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

Loading…
Cancel
Save