WPF-Control-ItemsControl

#region 程序集 PresentationFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\10.0.9\ref\net10.0\PresentationFramework.dll
#endregion

using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Markup;

namespace System.Windows.Controls
{
    //
    // 摘要:
    //     Represents a control that can be used to present a collection of items.
    [ContentProperty("Items")]
    [DefaultEvent("OnItemsChanged")]
    [DefaultProperty("Items")]
    [Localizability(LocalizationCategory.None, Readability = Readability.Unreadable)]
    [StyleTypedProperty(Property = "ItemContainerStyle", StyleTargetType = typeof(FrameworkElement))]
    public class ItemsControl : Control, IContainItemStorage, IAddChild
    {
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.AlternationCount dependency
        //     property.
        public static readonly DependencyProperty AlternationCountProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.ItemTemplateSelector dependency
        //     property.
        public static readonly DependencyProperty ItemTemplateSelectorProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.ItemTemplate dependency property.
        public static readonly DependencyProperty ItemTemplateProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.ItemStringFormat dependency
        //     property.
        public static readonly DependencyProperty ItemStringFormatProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.ItemsPanel dependency property.
        public static readonly DependencyProperty ItemsPanelProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.ItemContainerStyleSelector
        //     dependency property.
        public static readonly DependencyProperty ItemContainerStyleSelectorProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.ItemContainerStyle dependency
        //     property.
        public static readonly DependencyProperty ItemContainerStyleProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.ItemBindingGroup dependency
        //     property.
        public static readonly DependencyProperty ItemBindingGroupProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.ItemsSource dependency property.
        public static readonly DependencyProperty ItemsSourceProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.IsTextSearchCaseSensitive
        //     dependency property.
        public static readonly DependencyProperty IsTextSearchCaseSensitiveProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.IsGrouping dependency property.
        public static readonly DependencyProperty IsGroupingProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.HasItems dependency property.
        public static readonly DependencyProperty HasItemsProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.GroupStyleSelector dependency
        //     property.
        public static readonly DependencyProperty GroupStyleSelectorProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.DisplayMemberPath dependency
        //     property.
        public static readonly DependencyProperty DisplayMemberPathProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.AlternationIndex dependency
        //     property.
        public static readonly DependencyProperty AlternationIndexProperty;
        //
        // 摘要:
        //     Identifies the System.Windows.Controls.ItemsControl.IsTextSearchEnabled dependency
        //     property.
        public static readonly DependencyProperty IsTextSearchEnabledProperty;

        //
        // 摘要:
        //     Initializes a new instance of the System.Windows.Controls.ItemsControl class.
        public ItemsControl();

        //
        // 摘要:
        //     Gets or sets a value that indicates whether System.Windows.Controls.TextSearch
        //     is enabled on the System.Windows.Controls.ItemsControl instance.
        //
        // 返回结果:
        //     true if System.Windows.Controls.TextSearch is enabled; otherwise, false. The
        //     default is false.
        public bool IsTextSearchEnabled { get; set; }
        //
        // 摘要:
        //     Gets or sets a path to a value on the source object to serve as the visual representation
        //     of the object.
        //
        // 返回结果:
        //     The path to a value on the source object. This can be any path, or an XPath such
        //     as "@Name". The default is an empty string ("").
        [Bindable(true)]
        public string DisplayMemberPath { get; set; }
        //
        // 摘要:
        //     Gets a collection of System.Windows.Controls.GroupStyle objects that define the
        //     appearance of each level of groups.
        //
        // 返回结果:
        //     A collection of System.Windows.Controls.GroupStyle objects that define the appearance
        //     of each level of groups.
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ObservableCollection<GroupStyle> GroupStyle { get; }
        //
        // 摘要:
        //     Gets or sets a method that enables you to provide custom selection logic for
        //     a System.Windows.Controls.GroupStyle to apply to each group in a collection.
        //
        //
        // 返回结果:
        //     A method that enables you to provide custom selection logic for a System.Windows.Controls.GroupStyle
        //     to apply to each group in a collection.
        [Bindable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public GroupStyleSelector GroupStyleSelector { get; set; }
        //
        // 摘要:
        //     Gets a value that indicates whether the System.Windows.Controls.ItemsControl
        //     contains items.
        //
        // 返回结果:
        //     true if the items count is greater than 0; otherwise, false. The default is false.
        [Bindable(false)]
        [Browsable(false)]
        public bool HasItems { get; }
        //
        // 摘要:
        //     Gets a value that indicates whether the control is using grouping.
        //
        // 返回结果:
        //     true if a control is using grouping; otherwise, false.
        [Bindable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public bool IsGrouping { get; }
        //
        // 摘要:
        //     Gets or sets a value that indicates whether case is a condition when searching
        //     for items.
        //
        // 返回结果:
        //     true if text searches are case-sensitive; otherwise, false.
        public bool IsTextSearchCaseSensitive { get; set; }
        //
        // 摘要:
        //     Gets or sets the System.Windows.Data.BindingGroup that is copied to each item
        //     in the System.Windows.Controls.ItemsControl.
        //
        // 返回结果:
        //     The System.Windows.Data.BindingGroup that is copied to each item in the System.Windows.Controls.ItemsControl.
        [Bindable(true)]
        public BindingGroup ItemBindingGroup { get; set; }
        //
        // 摘要:
        //     Gets or sets the System.Windows.DataTemplate used to display each item.
        //
        // 返回结果:
        //     A System.Windows.DataTemplate that specifies the visualization of the data objects.
        //     The default is null.
        [Bindable(true)]
        public DataTemplate ItemTemplate { get; set; }
        //
        // 摘要:
        //     Gets or sets the System.Windows.Style that is applied to the container element
        //     generated for each item.
        //
        // 返回结果:
        //     The System.Windows.Style that is applied to the container element generated for
        //     each item. The default is null.
        [Bindable(true)]
        [Category("Content")]
        public Style ItemContainerStyle { get; set; }
        //
        // 摘要:
        //     Gets or sets custom style-selection logic for a style that can be applied to
        //     each generated container element.
        //
        // 返回结果:
        //     A System.Windows.Controls.StyleSelector object that contains logic that chooses
        //     the style to use as the System.Windows.Controls.ItemsControl.ItemContainerStyle.
        //     The default is null.
        [Bindable(true)]
        [Category("Content")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public StyleSelector ItemContainerStyleSelector { get; set; }
        //
        // 摘要:
        //     Gets the collection used to generate the content of the System.Windows.Controls.ItemsControl.
        //
        //
        // 返回结果:
        //     The collection that is used to generate the content of the System.Windows.Controls.ItemsControl.
        //     The default is an empty collection.
        [Bindable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ItemCollection Items { get; }
        //
        // 摘要:
        //     Gets or sets the template that defines the panel that controls the layout of
        //     items.
        //
        // 返回结果:
        //     An System.Windows.Controls.ItemsPanelTemplate that defines the panel to use for
        //     the layout of the items. The default value for the System.Windows.Controls.ItemsControl
        //     is an System.Windows.Controls.ItemsPanelTemplate that specifies a System.Windows.Controls.StackPanel.
        [Bindable(false)]
        public ItemsPanelTemplate ItemsPanel { get; set; }
        //
        // 摘要:
        //     Gets or sets a collection used to generate the content of the System.Windows.Controls.ItemsControl.
        //
        //
        // 返回结果:
        //     A collection that is used to generate the content of the System.Windows.Controls.ItemsControl.
        //     The default is null.
        [Bindable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public IEnumerable ItemsSource { get; set; }
        //
        // 摘要:
        //     Gets or sets a composite string that specifies how to format the items in the
        //     System.Windows.Controls.ItemsControl if they are displayed as strings.
        //
        // 返回结果:
        //     A composite string that specifies how to format the items in the System.Windows.Controls.ItemsControl
        //     if they are displayed as strings.
        [Bindable(true)]
        public string ItemStringFormat { get; set; }
        //
        // 摘要:
        //     Gets or sets the custom logic for choosing a template used to display each item.
        //
        //
        // 返回结果:
        //     A custom System.Windows.Controls.DataTemplateSelector object that provides logic
        //     and returns a System.Windows.DataTemplate. The default is null.
        [Bindable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public DataTemplateSelector ItemTemplateSelector { get; set; }
        //
        // 摘要:
        //     Gets the System.Windows.Controls.ItemContainerGenerator that is associated with
        //     the control.
        //
        // 返回结果:
        //     The System.Windows.Controls.ItemContainerGenerator that is associated with the
        //     control. The default is null.
        [Bindable(false)]
        [Browsable(false)]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        public ItemContainerGenerator ItemContainerGenerator { get; }
        //
        // 摘要:
        //     Gets or sets the number of alternating item containers in the System.Windows.Controls.ItemsControl,
        //     which enables alternating containers to have a unique appearance.
        //
        // 返回结果:
        //     The number of alternating item containers in the System.Windows.Controls.ItemsControl.
        [Bindable(true)]
        public int AlternationCount { get; set; }
        //
        // 摘要:
        //     Gets an enumerator for the logical child objects of the System.Windows.Controls.ItemsControl
        //     object.
        //
        // 返回结果:
        //     An enumerator for the logical child objects of the System.Windows.Controls.ItemsControl
        //     object. The default is null.
        protected internal override IEnumerator LogicalChildren { get; }

        //
        // 摘要:
        //     Returns the container that belongs to the specified System.Windows.Controls.ItemsControl
        //     that owns the given container element.
        //
        // 参数:
        //   itemsControl:
        //     The System.Windows.Controls.ItemsControl to return the container for.
        //
        //   element:
        //     The element to return the container for.
        //
        // 返回结果:
        //     The container that belongs to the specified System.Windows.Controls.ItemsControl
        //     that owns the given element, if itemsControl is not null. If itemsControl is
        //     null, returns the closest container that belongs to any System.Windows.Controls.ItemsControl.
        public static DependencyObject ContainerFromElement(ItemsControl itemsControl, DependencyObject element);
        //
        // 摘要:
        //     Gets the System.Windows.Controls.ItemsControl.AlternationIndex for the specified
        //     object.
        //
        // 参数:
        //   element:
        //     The object from which to get the System.Windows.Controls.ItemsControl.AlternationIndex.
        //
        //
        // 返回结果:
        //     The value of the System.Windows.Controls.ItemsControl.AlternationIndex.
        public static int GetAlternationIndex(DependencyObject element);
        //
        // 摘要:
        //     Returns the System.Windows.Controls.ItemsControl that the specified element hosts
        //     items for.
        //
        // 参数:
        //   element:
        //     The host element.
        //
        // 返回结果:
        //     The System.Windows.Controls.ItemsControl that the specified element hosts items
        //     for, or null.
        public static ItemsControl GetItemsOwner(DependencyObject element);
        //
        // 摘要:
        //     Returns the System.Windows.Controls.ItemsControl that owns the specified container
        //     element.
        //
        // 参数:
        //   container:
        //     The container element to return the System.Windows.Controls.ItemsControl for.
        //
        //
        // 返回结果:
        //     The System.Windows.Controls.ItemsControl that owns the specified container element.
        public static ItemsControl ItemsControlFromItemContainer(DependencyObject container);
        //
        // 摘要:
        //     Indicates that the initialization of the System.Windows.Controls.ItemsControl
        //     object is about to start.
        public override void BeginInit();
        //
        // 摘要:
        //     Returns the container that belongs to the current System.Windows.Controls.ItemsControl
        //     that owns the given element.
        //
        // 参数:
        //   element:
        //     The element to return the container for.
        //
        // 返回结果:
        //     The container that belongs to the current System.Windows.Controls.ItemsControl
        //     that owns the given element or null if no such container exists.
        public DependencyObject ContainerFromElement(DependencyObject element);
        //
        // 摘要:
        //     Indicates that the initialization of the System.Windows.Controls.ItemsControl
        //     object is complete.
        public override void EndInit();
        //
        // 摘要:
        //     Determines if the specified item is (or is eligible to be) its own container.
        //
        //
        // 参数:
        //   item:
        //     The item to check.
        //
        // 返回结果:
        //     true if the item is (or is eligible to be) its own container; otherwise, false.
        public bool IsItemItsOwnContainer(object item);
        //
        // 摘要:
        //     Returns a value that indicates whether serialization processes should serialize
        //     the effective value of the System.Windows.Controls.ItemsControl.GroupStyle property.
        //
        //
        // 返回结果:
        //     true if the System.Windows.Controls.ItemsControl.GroupStyle property value should
        //     be serialized; otherwise, false.
        [EditorBrowsable(EditorBrowsableState.Never)]
        public bool ShouldSerializeGroupStyle();
        //
        // 摘要:
        //     Returns a value that indicates whether serialization processes should serialize
        //     the effective value of the System.Windows.Controls.ItemsControl.Items property.
        //
        //
        // 返回结果:
        //     true if the System.Windows.Controls.ItemsControl.Items property value should
        //     be serialized; otherwise, false.
        [EditorBrowsable(EditorBrowsableState.Never)]
        public bool ShouldSerializeItems();
        //
        // 摘要:
        //     Provides a string representation of the System.Windows.Controls.ItemsControl
        //     object.
        //
        // 返回结果:
        //     The string representation of the object.
        public override string ToString();
        //
        // 摘要:
        //     Adds the specified object as the child of the System.Windows.Controls.ItemsControl
        //     object.
        //
        // 参数:
        //   value:
        //     The object to add as a child.
        protected virtual void AddChild(object value);
        //
        // 摘要:
        //     Adds the specified text string to the System.Windows.Controls.ItemsControl object.
        //
        //
        // 参数:
        //   text:
        //     The string to add.
        protected virtual void AddText(string text);
        //
        // 摘要:
        //     When overridden in a derived class, undoes the effects of the System.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(System.Windows.DependencyObject,System.Object)
        //     method.
        //
        // 参数:
        //   element:
        //     The container element.
        //
        //   item:
        //     The item.
        protected virtual void ClearContainerForItemOverride(DependencyObject element, object item);
        //
        // 摘要:
        //     Creates or identifies the element that is used to display the given item.
        //
        // 返回结果:
        //     The element that is used to display the given item.
        protected virtual DependencyObject GetContainerForItemOverride();
        //
        // 摘要:
        //     Determines if the specified item is (or is eligible to be) its own container.
        //
        //
        // 参数:
        //   item:
        //     The item to check.
        //
        // 返回结果:
        //     true if the item is (or is eligible to be) its own container; otherwise, false.
        protected virtual bool IsItemItsOwnContainerOverride(object item);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.AlternationCount property
        //     changes.
        //
        // 参数:
        //   oldAlternationCount:
        //     The old value of System.Windows.Controls.ItemsControl.AlternationCount.
        //
        //   newAlternationCount:
        //     The new value of System.Windows.Controls.ItemsControl.AlternationCount.
        protected virtual void OnAlternationCountChanged(int oldAlternationCount, int newAlternationCount);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.DisplayMemberPath property
        //     changes.
        //
        // 参数:
        //   oldDisplayMemberPath:
        //     The old value of the System.Windows.Controls.ItemsControl.DisplayMemberPath property.
        //
        //
        //   newDisplayMemberPath:
        //     New value of the System.Windows.Controls.ItemsControl.DisplayMemberPath property.
        protected virtual void OnDisplayMemberPathChanged(string oldDisplayMemberPath, string newDisplayMemberPath);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.GroupStyleSelector property
        //     changes.
        //
        // 参数:
        //   oldGroupStyleSelector:
        //     Old value of the System.Windows.Controls.ItemsControl.GroupStyleSelector property.
        //
        //
        //   newGroupStyleSelector:
        //     New value of the System.Windows.Controls.ItemsControl.GroupStyleSelector property.
        protected virtual void OnGroupStyleSelectorChanged(GroupStyleSelector oldGroupStyleSelector, GroupStyleSelector newGroupStyleSelector);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.ItemBindingGroup property
        //     changes.
        //
        // 参数:
        //   oldItemBindingGroup:
        //     The old value of the System.Windows.Controls.ItemsControl.ItemBindingGroup.
        //
        //   newItemBindingGroup:
        //     The new value of the System.Windows.Controls.ItemsControl.ItemBindingGroup.
        protected virtual void OnItemBindingGroupChanged(BindingGroup oldItemBindingGroup, BindingGroup newItemBindingGroup);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.ItemContainerStyle property
        //     changes.
        //
        // 参数:
        //   oldItemContainerStyle:
        //     Old value of the System.Windows.Controls.ItemsControl.ItemContainerStyle property.
        //
        //
        //   newItemContainerStyle:
        //     New value of the System.Windows.Controls.ItemsControl.ItemContainerStyle property.
        protected virtual void OnItemContainerStyleChanged(Style oldItemContainerStyle, Style newItemContainerStyle);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.ItemContainerStyleSelector
        //     property changes.
        //
        // 参数:
        //   oldItemContainerStyleSelector:
        //     Old value of the System.Windows.Controls.ItemsControl.ItemContainerStyleSelector
        //     property.
        //
        //   newItemContainerStyleSelector:
        //     New value of the System.Windows.Controls.ItemsControl.ItemContainerStyleSelector
        //     property.
        protected virtual void OnItemContainerStyleSelectorChanged(StyleSelector oldItemContainerStyleSelector, StyleSelector newItemContainerStyleSelector);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.Items property changes.
        //
        //
        // 参数:
        //   e:
        //     Information about the change.
        protected virtual void OnItemsChanged(NotifyCollectionChangedEventArgs e);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.ItemsPanel property changes.
        //
        //
        // 参数:
        //   oldItemsPanel:
        //     Old value of the System.Windows.Controls.ItemsControl.ItemsPanel property.
        //
        //   newItemsPanel:
        //     New value of the System.Windows.Controls.ItemsControl.ItemsPanel property.
        protected virtual void OnItemsPanelChanged(ItemsPanelTemplate oldItemsPanel, ItemsPanelTemplate newItemsPanel);
        //
        // 摘要:
        //     Called when the System.Windows.Controls.ItemsControl.ItemsSource property changes.
        //
        //
        // 参数:
        //   oldValue:
        //     Old value of the System.Windows.Controls.ItemsControl.ItemsSource property.
        //
        //   newValue:
        //     New value of the System.Windows.Controls.ItemsControl.ItemsSource property.
        protected virtual void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable newValue);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.ItemStringFormat property
        //     changes.
        //
        // 参数:
        //   oldItemStringFormat:
        //     The old value of the System.Windows.Controls.ItemsControl.ItemStringFormat property.
        //
        //
        //   newItemStringFormat:
        //     The new value of the System.Windows.Controls.ItemsControl.ItemStringFormat property.
        protected virtual void OnItemStringFormatChanged(string oldItemStringFormat, string newItemStringFormat);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.ItemTemplate property changes.
        //
        //
        // 参数:
        //   oldItemTemplate:
        //     The old System.Windows.Controls.ItemsControl.ItemTemplate property value.
        //
        //   newItemTemplate:
        //     The new System.Windows.Controls.ItemsControl.ItemTemplate property value.
        protected virtual void OnItemTemplateChanged(DataTemplate oldItemTemplate, DataTemplate newItemTemplate);
        //
        // 摘要:
        //     Invoked when the System.Windows.Controls.ItemsControl.ItemTemplateSelector property
        //     changes.
        //
        // 参数:
        //   oldItemTemplateSelector:
        //     Old value of the System.Windows.Controls.ItemsControl.ItemTemplateSelector property.
        //
        //
        //   newItemTemplateSelector:
        //     New value of the System.Windows.Controls.ItemsControl.ItemTemplateSelector property.
        protected virtual void OnItemTemplateSelectorChanged(DataTemplateSelector oldItemTemplateSelector, DataTemplateSelector newItemTemplateSelector);
        //
        // 摘要:
        //     Invoked when the System.Windows.UIElement.KeyDown event is received.
        //
        // 参数:
        //   e:
        //     Information about the event.
        protected override void OnKeyDown(KeyEventArgs e);
        //
        // 摘要:
        //     Invoked when the System.Windows.UIElement.TextInput event is received.
        //
        // 参数:
        //   e:
        //     Information about the event.
        protected override void OnTextInput(TextCompositionEventArgs e);
        //
        // 摘要:
        //     Prepares the specified element to display the specified item.
        //
        // 参数:
        //   element:
        //     Element used to display the specified item.
        //
        //   item:
        //     Specified item.
        protected virtual void PrepareContainerForItemOverride(DependencyObject element, object item);
        //
        // 摘要:
        //     Returns a value that indicates whether to apply the style from the System.Windows.Controls.ItemsControl.ItemContainerStyle
        //     or System.Windows.Controls.ItemsControl.ItemContainerStyleSelector property to
        //     the container element of the specified item.
        //
        // 参数:
        //   container:
        //     The container element.
        //
        //   item:
        //     The item of interest.
        //
        // 返回结果:
        //     Always true for the base implementation.
        protected virtual bool ShouldApplyItemContainerStyle(DependencyObject container, object item);
    }
}

image

image

posted @ 2026-06-15 13:24  Tony.Jia  阅读(8)  评论(0)    收藏  举报