From 22f266f99499d433009e6d616efb309c05e947ec Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 28 Mar 2023 22:18:56 +0200 Subject: [PATCH] ItemsRepeater.Items -> ItemsSource. --- .../Pages/ItemsRepeaterPage.xaml | 2 +- .../Controls/ItemsRepeater.cs | 22 +++++++++---------- .../ItemsRepeaterTests.cs | 8 +++---- .../Xaml/StyleTests.cs | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml index 6bf29765f4..88be9f8e6e 100644 --- a/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml +++ b/samples/ControlCatalog/Pages/ItemsRepeaterPage.xaml @@ -66,7 +66,7 @@ - diff --git a/src/Avalonia.Controls.ItemsRepeater/Controls/ItemsRepeater.cs b/src/Avalonia.Controls.ItemsRepeater/Controls/ItemsRepeater.cs index 499904deac..5fe9c6fa05 100644 --- a/src/Avalonia.Controls.ItemsRepeater/Controls/ItemsRepeater.cs +++ b/src/Avalonia.Controls.ItemsRepeater/Controls/ItemsRepeater.cs @@ -36,13 +36,13 @@ namespace Avalonia.Controls ItemsControl.ItemTemplateProperty.AddOwner(); /// - /// Defines the property. + /// Defines the property. /// - public static readonly DirectProperty ItemsProperty = + public static readonly DirectProperty ItemsSourceProperty = AvaloniaProperty.RegisterDirect( - nameof(Items), - o => o.Items, - (o, v) => o.Items = v); + nameof(ItemsSource), + o => o.ItemsSource, + (o, v) => o.ItemsSource = v); /// /// Defines the property. @@ -65,7 +65,7 @@ namespace Avalonia.Controls private readonly ViewManager _viewManager; private readonly ViewportManager _viewportManager; private readonly TargetWeakEventSubscriber _layoutWeakSubscriber; - private IEnumerable? _items; + private IEnumerable? _itemsSource; private RepeaterLayoutContext? _layoutContext; private EventHandler? _childIndexChanged; private bool _isLayoutInProgress; @@ -116,16 +116,16 @@ namespace Avalonia.Controls /// /// Gets or sets an object source used to generate the content of the ItemsRepeater. /// - public IEnumerable? Items + public IEnumerable? ItemsSource { - get => _items; - set => SetAndRaise(ItemsProperty, ref _items, value); + get => _itemsSource; + set => SetAndRaise(ItemsSourceProperty, ref _itemsSource, value); } /// /// Gets or sets the template used to display each item. /// - [InheritDataTypeFromItems(nameof(Items))] + [InheritDataTypeFromItems(nameof(ItemsSource))] public IDataTemplate? ItemTemplate { get => GetValue(ItemTemplateProperty); @@ -415,7 +415,7 @@ namespace Avalonia.Controls /// protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) { - if (change.Property == ItemsProperty) + if (change.Property == ItemsSourceProperty) { var (oldEnumerable, newEnumerable) = change.GetOldAndNewValue(); diff --git a/tests/Avalonia.Controls.ItemsRepeater.UnitTests/ItemsRepeaterTests.cs b/tests/Avalonia.Controls.ItemsRepeater.UnitTests/ItemsRepeaterTests.cs index 321676abc0..3c4777688d 100644 --- a/tests/Avalonia.Controls.ItemsRepeater.UnitTests/ItemsRepeaterTests.cs +++ b/tests/Avalonia.Controls.ItemsRepeater.UnitTests/ItemsRepeaterTests.cs @@ -9,16 +9,16 @@ namespace Avalonia.Controls.UnitTests public void Can_Reassign_Items() { var target = new ItemsRepeater(); - target.Items = new ObservableCollection(); - target.Items = new ObservableCollection(); + target.ItemsSource = new ObservableCollection(); + target.ItemsSource = new ObservableCollection(); } [Fact] public void Can_Reassign_Items_To_Null() { var target = new ItemsRepeater(); - target.Items = new ObservableCollection(); - target.Items = null; + target.ItemsSource = new ObservableCollection(); + target.ItemsSource = null; } } } diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs index 20a4543b72..2c20b7a0b7 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/StyleTests.cs @@ -424,7 +424,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml }; var list = window.FindControl("list"); - list.Items = collection; + list.ItemsSource = collection; window.Show();