Jelajahi Sumber

Remove all remaining uses of Items setter.

Steven Kirk 2 tahun lalu
induk
melakukan
996578f2bf

+ 2 - 2
samples/BindingDemo/MainWindow.xaml

@@ -75,11 +75,11 @@
         </StackPanel.DataTemplates>
         <StackPanel Margin="18" Spacing="4" Width="200">
           <TextBlock FontSize="16" Text="Multiple"/>
-          <ListBox Items="{Binding Items}" SelectionMode="Multiple" Selection="{Binding Selection}"/>
+          <ListBox ItemsSource="{Binding Items}" SelectionMode="Multiple" Selection="{Binding Selection}"/>
         </StackPanel>
         <StackPanel Margin="18" Spacing="4" Width="200">
           <TextBlock FontSize="16" Text="Multiple"/>
-          <ListBox Items="{Binding Items}" SelectionMode="Multiple" Selection="{Binding Selection}"/>
+          <ListBox ItemsSource="{Binding Items}" SelectionMode="Multiple" Selection="{Binding Selection}"/>
         </StackPanel>
         <ContentControl Content="{ReflectionBinding Selection.SelectedItems[0]}">
           <ContentControl.DataTemplates>

+ 1 - 1
samples/ControlCatalog/Pages/TabControlPage.xaml

@@ -51,7 +51,7 @@
                     Text="From DataTemplate">
                 </TextBlock>
                 <TabControl
-                    Items="{Binding Tabs}"
+                    ItemsSource="{Binding Tabs}"
                     Margin="0 16"
                     DisplayMemberBinding="{Binding Header, x:DataType=viewModels:TabControlPageViewModelItem}"
                     TabStripPlacement="{Binding TabPlacement}">

+ 4 - 4
samples/VirtualizationDemo/MainWindow.xaml

@@ -11,7 +11,7 @@
                     Margin="16 0 0 0" 
                     Width="150"
                     Spacing="4">
-            <ComboBox Items="{Binding Orientations}"
+            <ComboBox ItemsSource="{Binding Orientations}"
                       SelectedItem="{Binding Orientation}"/>
             <TextBox Watermark="Item Count"
                      UseFloatingWatermark="True"
@@ -26,10 +26,10 @@
                      UseFloatingWatermark="True"
                      Text="{Binding #listBox.Scroll.Viewport, Mode=OneWay}"/>
             <TextBlock>Horiz. ScrollBar</TextBlock>
-            <ComboBox Items="{Binding ScrollBarVisibilities}"
+            <ComboBox ItemsSource="{Binding ScrollBarVisibilities}"
                       SelectedItem="{Binding HorizontalScrollBarVisibility}"/>
             <TextBlock>Vert. ScrollBar</TextBlock>
-            <ComboBox Items="{Binding ScrollBarVisibilities}"
+            <ComboBox ItemsSource="{Binding ScrollBarVisibilities}"
                       SelectedItem="{Binding VerticalScrollBarVisibility}"/>
             <TextBox Watermark="Item to Create"
                      UseFloatingWatermark="True"
@@ -44,7 +44,7 @@
         </StackPanel>
 
         <ListBox Name="listBox" 
-                 Items="{Binding Items}" 
+                 ItemsSource="{Binding Items}" 
                  Selection="{Binding Selection}"
                  SelectionMode="Multiple"
                  ScrollViewer.HorizontalScrollBarVisibility="{Binding HorizontalScrollBarVisibility, Mode=TwoWay}"

+ 1 - 1
src/Avalonia.Controls/Flyouts/MenuFlyout.cs

@@ -90,7 +90,7 @@ namespace Avalonia.Controls
         {
             return new MenuFlyoutPresenter
             {
-                [!ItemsControl.ItemsProperty] = this[!ItemsProperty],
+                [!ItemsControl.ItemsSourceProperty] = this[!ItemsProperty],
                 [!ItemsControl.ItemTemplateProperty] = this[!ItemTemplateProperty],
                 [!ItemsControl.ItemContainerThemeProperty] = this[!ItemContainerThemeProperty],
             };

+ 1 - 1
src/Avalonia.Controls/Primitives/HeaderedItemsControl.cs

@@ -124,7 +124,7 @@ namespace Avalonia.Controls.Primitives
                 treeTemplate.Match(item) &&
                 treeTemplate.ItemsSelector(item) is { } itemsBinding)
             {
-                _itemsBinding = BindingOperations.Apply(this, ItemsProperty, itemsBinding, null);
+                _itemsBinding = BindingOperations.Apply(this, ItemsSourceProperty, itemsBinding, null);
             }
         }
 

+ 2 - 2
tests/Avalonia.Markup.Xaml.UnitTests/Xaml/ControlBindingTests.cs

@@ -73,14 +73,14 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml
                 var xaml = @"
 <Window xmlns='https://github.com/avaloniaui'>
     <DockPanel>
-        <TabStrip Name='strip' DockPanel.Dock='Top' Items='{Binding Items}' SelectedIndex='0'>
+        <TabStrip Name='strip' DockPanel.Dock='Top' ItemsSource='{Binding Items}' SelectedIndex='0'>
           <TabStrip.ItemTemplate>
             <DataTemplate>
               <TextBlock Text='{Binding Header}'/>
             </DataTemplate>
           </TabStrip.ItemTemplate>
         </TabStrip>
-        <Carousel Name='carousel' Items='{Binding Items}' SelectedIndex='{Binding #strip.SelectedIndex}'>
+        <Carousel Name='carousel' ItemsSource='{Binding Items}' SelectedIndex='{Binding #strip.SelectedIndex}'>
           <Carousel.ItemTemplate>
             <DataTemplate>
               <TextBlock Text='{Binding Detail}'/>