/// <summary>
 ///     Used to create an unset DataGridCellInfo.
 /// </summary>
 internal DataGridCellInfo(object item)
 {
     Debug.Assert(item == DependencyProperty.UnsetValue, "This should only be used to make an Unset CellInfo.");
     _info   = new ItemsControl.ItemInfo(item);
     _column = null;
     _owner  = null;
 }
Esempio n. 2
0
 // Token: 0x060055E7 RID: 21991 RVA: 0x0017CDF9 File Offset: 0x0017AFF9
 internal void Remove(ItemsControl.ItemInfo info)
 {
     if (!this._selector.SelectionChange.IsActive || !this._updatingSelectedItems)
     {
         throw new InvalidOperationException(SR.Get("DeferSelectionNotActive"));
     }
     this._selector.SelectionChange.Unselect(info);
 }
Esempio n. 3
0
        /// <summary>
        /// Remove an ItemInfo from the deferred selection
        /// </summary>
        internal void Remove(ItemsControl.ItemInfo info)
        {
            if (!_selector.SelectionChange.IsActive || !_updatingSelectedItems)
            {
                throw new InvalidOperationException("Cannot end a selection when no selection is in progress.");
            }

            _selector.SelectionChange.Unselect(info);
        }
Esempio n. 4
0
        /// <summary>
        /// Add an ItemInfo to the deferred selection
        /// </summary>
        internal void Add(ItemsControl.ItemInfo info)
        {
            if (!_selector.SelectionChange.IsActive || !_updatingSelectedItems)
            {
                throw new InvalidOperationException("Cannot end a selection when no selection is in progress.");
            }

            _selector.SelectionChange.Select(info, true /* assumeInItemsCollection */);
        }
        /// <summary>
        /// Add an ItemInfo to the deferred selection
        /// </summary>
        internal void Add(ItemsControl.ItemInfo info)
        {
            if (!_selector.SelectionChange.IsActive || !_updatingSelectedItems)
            {
                throw new InvalidOperationException(SR.Get(SRID.DeferSelectionNotActive));
            }

            _selector.SelectionChange.Select(info, true /* assumeInItemsCollection */);
        }
 // Token: 0x0600513E RID: 20798 RVA: 0x0016C9B4 File Offset: 0x0016ABB4
 private void MakeSingleSelection(ListBoxItem listItem)
 {
     if (ItemsControl.ItemsControlFromItemContainer(listItem) == this)
     {
         ItemsControl.ItemInfo info = base.ItemInfoFromContainer(listItem);
         base.SelectionChange.SelectJustThisItem(info, true);
         listItem.Focus();
         this.UpdateAnchorAndActionItem(info);
     }
 }
        internal DataGridCellInfo(ItemsControl.ItemInfo info, DataGridColumn column, DataGrid owner)
        {
            Debug.Assert(info != null, "item should not be null.");
            Debug.Assert(column != null, "column should not be null.");
            Debug.Assert(owner != null, "owner should not be null.");

            _info   = info;
            _column = column;
            _owner  = new WeakReference(owner);
        }
        /// <summary>
        ///     Identifies a cell at the column within the row for the specified item.
        /// </summary>
        /// <param name="item">The item who's row contains the cell.</param>
        /// <param name="column">The column of the cell within the row.</param>
        /// <remarks>
        ///     This constructor will not tie the DataGridCellInfo to any particular
        ///     DataGrid.
        /// </remarks>
        public DataGridCellInfo(object item, DataGridColumn column)
        {
            if (column == null)
            {
                throw new ArgumentNullException("column");
            }

            _info   = new ItemsControl.ItemInfo(item);
            _column = column;
            _owner  = null;
        }
        // Token: 0x06005146 RID: 20806 RVA: 0x0016CC6C File Offset: 0x0016AE6C
        internal override bool FocusItem(ItemsControl.ItemInfo info, ItemsControl.ItemNavigateArgs itemNavigateArgs)
        {
            bool        result      = base.FocusItem(info, itemNavigateArgs);
            ListBoxItem listBoxItem = info.Container as ListBoxItem;

            if (listBoxItem != null)
            {
                this.LastActionItem = listBoxItem;
                this.MakeKeyboardSelection(listBoxItem);
            }
            return(result);
        }
Esempio n. 10
0
        // Token: 0x060058EA RID: 22762 RVA: 0x00189810 File Offset: 0x00187A10
        private bool HandleScrollByPage(KeyEventArgs e)
        {
            IInputElement focusedElement = Keyboard.FocusedElement;
            ItemsControl  itemsControl   = ItemsControl.ItemsControlFromItemContainer(this._selectedContainer);

            ItemsControl.ItemInfo startingInfo     = (itemsControl != null) ? itemsControl.ItemInfoFromContainer(this._selectedContainer) : null;
            FrameworkElement      frameworkElement = this._selectedContainer.HeaderElement;

            if (frameworkElement == null)
            {
                frameworkElement = this._selectedContainer;
            }
            return(base.NavigateByPage(startingInfo, frameworkElement, (e.Key == Key.Prior) ? FocusNavigationDirection.Up : FocusNavigationDirection.Down, new ItemsControl.ItemNavigateArgs(e.Device, Keyboard.Modifiers)));
        }
Esempio n. 11
0
        // Token: 0x060051CD RID: 20941 RVA: 0x0016E190 File Offset: 0x0016C390
        internal override bool FocusItem(ItemsControl.ItemInfo info, ItemsControl.ItemNavigateArgs itemNavigateArgs)
        {
            bool result = base.FocusItem(info, itemNavigateArgs);

            if (itemNavigateArgs.DeviceUsed is KeyboardDevice)
            {
                MenuItem menuItem = info.Container as MenuItem;
                if (menuItem != null && menuItem.Role == MenuItemRole.TopLevelHeader && menuItem.IsSubmenuOpen)
                {
                    menuItem.NavigateToStart(itemNavigateArgs);
                }
            }
            return(result);
        }
        // Token: 0x0600513D RID: 20797 RVA: 0x0016C964 File Offset: 0x0016AB64
        private void UpdateAnchorAndActionItem(ItemsControl.ItemInfo info)
        {
            object      item        = info.Item;
            ListBoxItem listBoxItem = info.Container as ListBoxItem;

            if (item == DependencyProperty.UnsetValue)
            {
                this.AnchorItemInternal = null;
                this.LastActionItem     = null;
            }
            else
            {
                this.AnchorItemInternal = info;
                this.LastActionItem     = listBoxItem;
            }
            KeyboardNavigation.SetTabOnceActiveElement(this, listBoxItem);
        }
Esempio n. 13
0
 // Token: 0x060055DB RID: 21979 RVA: 0x0017CA9C File Offset: 0x0017AC9C
 protected override void ClearItems()
 {
     if (this._updatingSelectedItems)
     {
         using (IEnumerator <ItemsControl.ItemInfo> enumerator = ((IEnumerable <ItemsControl.ItemInfo>) this._selector._selectedItems).GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 ItemsControl.ItemInfo info = enumerator.Current;
                 this._selector.SelectionChange.Unselect(info);
             }
             return;
         }
     }
     using (this.ChangeSelectedItems())
     {
         base.ClearItems();
     }
 }
 /// <summary>Responds to a list box selection change by raising a <see cref="E:System.Windows.Controls.Primitives.Selector.SelectionChanged" /> event. </summary>
 /// <param name="e">Provides data for <see cref="T:System.Windows.Controls.SelectionChangedEventArgs" />. </param>
 // Token: 0x06005130 RID: 20784 RVA: 0x0016C274 File Offset: 0x0016A474
 protected override void OnSelectionChanged(SelectionChangedEventArgs e)
 {
     base.OnSelectionChanged(e);
     if (this.SelectionMode == SelectionMode.Single)
     {
         ItemsControl.ItemInfo internalSelectedInfo = base.InternalSelectedInfo;
         ListBoxItem           listBoxItem          = (internalSelectedInfo != null) ? (internalSelectedInfo.Container as ListBoxItem) : null;
         if (listBoxItem != null)
         {
             this.UpdateAnchorAndActionItem(internalSelectedInfo);
         }
     }
     if (AutomationPeer.ListenerExists(AutomationEvents.SelectionPatternOnInvalidated) || AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected) || AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementAddedToSelection) || AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection))
     {
         ListBoxAutomationPeer listBoxAutomationPeer = UIElementAutomationPeer.CreatePeerForElement(this) as ListBoxAutomationPeer;
         if (listBoxAutomationPeer != null)
         {
             listBoxAutomationPeer.RaiseSelectionEvents(e);
         }
     }
 }
        // Token: 0x06005924 RID: 22820 RVA: 0x0018A270 File Offset: 0x00188470
        private bool HandleUpDownKey(bool up, KeyEventArgs e)
        {
            FocusNavigationDirection direction = up ? FocusNavigationDirection.Up : FocusNavigationDirection.Down;

            if (this.AllowHandleKeyEvent(direction))
            {
                TreeView      parentTreeView = this.ParentTreeView;
                IInputElement focusedElement = Keyboard.FocusedElement;
                if (parentTreeView != null)
                {
                    FrameworkElement frameworkElement = this.HeaderElement;
                    if (frameworkElement == null)
                    {
                        frameworkElement = this;
                    }
                    ItemsControl          itemsControl = ItemsControl.ItemsControlFromItemContainer(this);
                    ItemsControl.ItemInfo startingInfo = (itemsControl != null) ? itemsControl.ItemInfoFromContainer(this) : null;
                    return(parentTreeView.NavigateByLine(startingInfo, frameworkElement, direction, new ItemsControl.ItemNavigateArgs(e.Device, Keyboard.Modifiers)));
                }
            }
            return(false);
        }
        // Token: 0x06005140 RID: 20800 RVA: 0x0016CA28 File Offset: 0x0016AC28
        private void MakeAnchorSelection(ListBoxItem actionItem, bool clearCurrent)
        {
            ItemsControl.ItemInfo anchorItemInternal = this.AnchorItemInternal;
            if (anchorItemInternal == null)
            {
                if (this._selectedItems.Count > 0)
                {
                    this.AnchorItemInternal = this._selectedItems[this._selectedItems.Count - 1];
                }
                else
                {
                    this.AnchorItemInternal = base.NewItemInfo(base.Items[0], null, 0);
                }
                if ((anchorItemInternal = this.AnchorItemInternal) == null)
                {
                    return;
                }
            }
            int num  = this.ElementIndex(actionItem);
            int num2 = this.AnchorItemInternal.Index;

            if (num > num2)
            {
                int num3 = num;
                num  = num2;
                num2 = num3;
            }
            bool flag = false;

            if (!base.SelectionChange.IsActive)
            {
                flag = true;
                base.SelectionChange.Begin();
            }
            try
            {
                if (clearCurrent)
                {
                    for (int i = 0; i < this._selectedItems.Count; i++)
                    {
                        ItemsControl.ItemInfo itemInfo = this._selectedItems[i];
                        int index = itemInfo.Index;
                        if (index < num || num2 < index)
                        {
                            base.SelectionChange.Unselect(itemInfo);
                        }
                    }
                }
                IEnumerator enumerator = ((IEnumerable)base.Items).GetEnumerator();
                for (int j = 0; j <= num2; j++)
                {
                    enumerator.MoveNext();
                    if (j >= num)
                    {
                        base.SelectionChange.Select(base.NewItemInfo(enumerator.Current, null, j), true);
                    }
                }
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            finally
            {
                if (flag)
                {
                    base.SelectionChange.End();
                }
            }
            this.LastActionItem = actionItem;
            GC.KeepAlive(anchorItemInternal);
        }
 // Token: 0x06004728 RID: 18216 RVA: 0x00142617 File Offset: 0x00140817
 internal DataGridCellInfo(ItemsControl.ItemInfo info, DataGridColumn column, DataGrid owner)
 {
     this._info   = info;
     this._column = column;
     this._owner  = new WeakReference(owner);
 }