예제 #1
0
        /// <summary>
        /// Called when the value of the <see cref="SelectedIndex"/> or <see cref="SelectedItem"/>
        /// dependency properties change.
        /// </summary>
        private static void HandleSelectedContainerChanged(Selector selector, DependencyObject container)
        {
            var item = selector.ItemContainerGenerator.ItemFromContainer(container);
            if (item == null)
                return;

            if (GetIsSelected(container))
                return;

            selector.BeginChangeSelection();

            selector.UnselectAllItems();
            selector.SelectItem(item);

            selector.EndChangeSelection();
        }
            /// <summary>
            /// Initializes a new instance of the <see cref="SelectionCollection"/> class.
            /// </summary>
            /// <param name="owner">The <see cref="Selector"/> that owns this collection.</param>
            public SelectionCollection(Selector owner)
            {
                Contract.Require(owner, nameof(owner));

                this.owner = owner;
            }
            /// <summary>
            /// Initializes a new instance of the <see cref="SelectionCollection"/> class.
            /// </summary>
            /// <param name="owner">The <see cref="Selector"/> that owns this collection.</param>
            public SelectionCollection(Selector owner)
            {
                Contract.Require(owner, "owner");

                this.owner = owner;
            }