Skip to content

Commit d097771

Browse files
Use PropertyChangingMethodName for validation, Fix Method Names
1 parent e4f5a3e commit d097771

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/CommunityToolkit.Maui/Layouts/DockLayout.shared.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public partial class DockLayout : Layout, IDockLayout
3333
/// <summary>
3434
/// Gets or sets the vertical spacing between elements.
3535
/// </summary>
36-
3736
[BindableProperty(PropertyChangedMethodName = nameof(OnVerticalSpacingPropertyChanged))]
3837
public partial double VerticalSpacing { get; set; } = DockLayoutDefaults.VerticalSpacing;
3938

src/CommunityToolkit.Maui/Layouts/UniformItemsLayout.shared.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,24 @@ public partial class UniformItemsLayout : Layout, IUniformItemsLayout
1414
/// <summary>
1515
/// Gets or sets the maximum number of rows to display or process.
1616
/// </summary>
17-
[BindableProperty(PropertyChangedMethodName = nameof(OnMaxRowsProperChanged))]
17+
[BindableProperty(PropertyChangingMethodName = nameof(OnMaxRowsPropertyChanging))]
1818
public partial int MaxRows { get; set; } = UniformItemLayoutDefaults.MaxRows;
1919

2020
/// <summary>
2121
/// Gets or sets the maximum number of columns to display in the layout.
2222
/// </summary>
23-
/// <remarks>Set this property to limit the number of columns arranged by the layout. The value must be greater
23+
/// <remarks>
24+
/// Set this property to limit the number of columns arranged by the layout. The value must be greater
2425
/// than or equal to 1. The default value is <see cref="int.MaxValue"/>, which allows an unlimited number of
25-
/// columns.</remarks>
26-
[BindableProperty(PropertyChangedMethodName = nameof(OnMaxColumnsProperChanged))]
26+
/// columns.
27+
/// </remarks>
28+
[BindableProperty(PropertyChangingMethodName = nameof(OnMaxColumnsPropertyChanging))]
2729
public partial int MaxColumns { get; set; } = UniformItemLayoutDefaults.MaxColumns;
30+
31+
/// <inheritdoc />
32+
protected override ILayoutManager CreateLayoutManager() => new UniformItemsLayoutManager(this);
2833

29-
static void OnMaxRowsProperChanged(BindableObject bindable, object oldValue, object newValue)
34+
static void OnMaxRowsPropertyChanging(BindableObject bindable, object oldValue, object newValue)
3035
{
3136
var maxRows = (int)newValue;
3237
if (maxRows < 1)
@@ -35,15 +40,12 @@ static void OnMaxRowsProperChanged(BindableObject bindable, object oldValue, obj
3540
}
3641
}
3742

38-
static void OnMaxColumnsProperChanged(BindableObject bindable, object oldValue, object newValue)
43+
static void OnMaxColumnsPropertyChanging(BindableObject bindable, object oldValue, object newValue)
3944
{
4045
var maxColumns = (int)newValue;
4146
if (maxColumns < 1)
4247
{
4348
throw new ArgumentOutOfRangeException(nameof(newValue), newValue, $"{nameof(MaxColumns)} must be greater or equal to 1.");
4449
}
4550
}
46-
47-
/// <inheritdoc />
48-
protected override ILayoutManager CreateLayoutManager() => new UniformItemsLayoutManager(this);
4951
}

0 commit comments

Comments
 (0)