Esempio n. 1
0
        private void DataGridElementView_LoadingRowGroup(object sender, Microsoft.Toolkit.Uwp.UI.Controls.DataGridRowGroupHeaderEventArgs e)
        {
            ICollectionViewGroup group = e.RowGroupHeader.CollectionViewGroup;
            ElementModel         item  = group.GroupItems[0] as ElementModel;

            e.RowGroupHeader.PropertyValue = item.Position.ToString();
        }
Esempio n. 2
0
        private void DataGrid_LoadingRowGroup(object sender, DataGridRowGroupHeaderEventArgs e)
        {
            ICollectionViewGroup group = e.RowGroupHeader.CollectionViewGroup;
            DataGridDataItem     item  = group.GroupItems[0] as DataGridDataItem;

            e.RowGroupHeader.PropertyValue = item.Range;
        }
Esempio n. 3
0
        private void DataGrid_LoadingRowGroup(object sender, Microsoft.Toolkit.Uwp.UI.Controls.DataGridRowGroupHeaderEventArgs e)
        {
            ICollectionViewGroup group = e.RowGroupHeader.CollectionViewGroup;
            var item = (PaymentViewModel)group.GroupItems[0];

            e.RowGroupHeader.PropertyValue = item.Date.ToString("D", CultureInfo.CurrentCulture);
        }
Esempio n. 4
0
        private void DataGridMaterialRequirements_LoadingRowGroup(object sender, DataGridRowGroupHeaderEventArgs e)
        {
            ICollectionViewGroup     group = e.RowGroupHeader.CollectionViewGroup;
            MaterialRequirementModel item  = group.GroupItems[0] as MaterialRequirementModel;

            e.RowGroupHeader.PropertyValue = item.MaterialNumber.ToString();
        }
Esempio n. 5
0
        private void DataGridPlantOrder_LoadingRowGroup(object sender, DataGridRowGroupHeaderEventArgs e)
        {
            ICollectionViewGroup group = e.RowGroupHeader.CollectionViewGroup;
            PlantOrderModel      item  = group.GroupItems[0] as PlantOrderModel;

            e.RowGroupHeader.PropertyValue = PlantOrderViewModel.GetPlantOrderMainNumber(item.Number);
        }
        public void ThisWeekDataGrid_LoadingRowGroup(object sender, DataGridRowGroupHeaderEventArgs args)
        {
            ICollectionViewGroup group = args.RowGroupHeader.CollectionViewGroup;
            var item = group.GroupItems[0] as Lesson;

            args.RowGroupHeader.PropertyValue          = item.DayOfWeek;
            args.RowGroupHeader.PropertyNameVisibility = Visibility.Collapsed;
            args.RowGroupHeader.ItemCountVisibility    = Visibility.Collapsed;
        }
Esempio n. 7
0
        /// <summary>
        /// Update onscreen group header DataContext when ICollectionViewGroup.Group property changes.
        /// </summary>
        internal override void OnGroupPropertyChanged(ICollectionViewGroup group, int groupIndex)
        {
            base.OnGroupPropertyChanged(group, groupIndex);

            var groupContainer = ContainerFromGroupIndex(groupIndex);

            if (groupContainer != null)
            {
                groupContainer.DataContext = group.Group;
            }
        }
 public DataGridRowGroupInfo(
     ICollectionViewGroup collectionViewGroup,
     Visibility visibility,
     int level,
     int slot,
     int lastSubItemSlot)
 {
     this.CollectionViewGroup = collectionViewGroup;
     this.Visibility          = visibility;
     this.Level           = level;
     this.Slot            = slot;
     this.LastSubItemSlot = lastSubItemSlot;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DataGridGroupItemAutomationPeer"/> class.
        /// </summary>
        public DataGridGroupItemAutomationPeer(ICollectionViewGroup group, DataGrid dataGrid)
            : base(dataGrid)
        {
            if (group == null)
            {
                throw new ArgumentNullException("group");
            }

            if (dataGrid == null)
            {
                throw new ArgumentNullException("dataGrid");
            }

            _group = group;
            _dataGridAutomationPeer = FrameworkElementAutomationPeer.CreatePeerForElement(dataGrid);
        }
Esempio n. 10
0
        private void CollectionView_CurrentChanged(object sender, object e)
        {
            if (_expectingCurrentChanged)
            {
                // Committing Edit could cause our item to move to a group that no longer exists.  In
                // this case, we need to update the item.
                ICollectionViewGroup collectionViewGroup = _itemToSelectOnCurrentChanged as ICollectionViewGroup;
                if (collectionViewGroup != null)
                {
                    DataGridRowGroupInfo groupInfo = _owner.RowGroupInfoFromCollectionViewGroup(collectionViewGroup);
                    if (groupInfo == null)
                    {
                        // Move to the next slot if the target slot isn't visible
                        if (!_owner.IsSlotVisible(_backupSlotForCurrentChanged))
                        {
                            _backupSlotForCurrentChanged = _owner.GetNextVisibleSlot(_backupSlotForCurrentChanged);
                        }

                        // Move to the next best slot if we've moved past all the slots.  This could happen if multiple
                        // groups were removed.
                        if (_backupSlotForCurrentChanged >= _owner.SlotCount)
                        {
                            _backupSlotForCurrentChanged = _owner.GetPreviousVisibleSlot(_owner.SlotCount);
                        }

                        // Update the itemToSelect
                        int newCurrentPosition = -1;
                        _itemToSelectOnCurrentChanged = _owner.ItemFromSlot(_backupSlotForCurrentChanged, ref newCurrentPosition);
                    }
                }

                _owner.ProcessSelectionAndCurrency(
                    _columnForCurrentChanged,
                    _itemToSelectOnCurrentChanged,
                    _backupSlotForCurrentChanged,
                    _selectionActionForCurrentChanged,
                    _scrollForCurrentChanged);
            }
            else if (this.CollectionView != null)
            {
                _owner.UpdateStateOnCurrentChanged(this.CollectionView.CurrentItem, this.CollectionView.CurrentPosition);
            }
        }
Esempio n. 11
0
        internal void PopulateGroupItemPeers()
        {
            Dictionary <object, DataGridGroupItemAutomationPeer> oldChildren = new Dictionary <object, DataGridGroupItemAutomationPeer>(_groupItemPeers);

            _groupItemPeers.Clear();

            if (this.OwningDataGrid.DataConnection.CollectionView != null &&
#if FEATURE_ICOLLECTIONVIEW_GROUP
                this.OwningDataGrid.DataConnection.CollectionView.CanGroup &&
#endif
                this.OwningDataGrid.DataConnection.CollectionView.CollectionGroups != null &&
                this.OwningDataGrid.DataConnection.CollectionView.CollectionGroups.Count > 0)
            {
                List <object> groups = new List <object>(this.OwningDataGrid.DataConnection.CollectionView.CollectionGroups);
                while (groups.Count > 0)
                {
                    ICollectionViewGroup cvGroup = groups[0] as ICollectionViewGroup;
                    groups.RemoveAt(0);
                    if (cvGroup != null)
                    {
                        // Add the group's peer to the collection
                        DataGridGroupItemAutomationPeer peer = null;

                        if (oldChildren.ContainsKey(cvGroup))
                        {
                            peer = oldChildren[cvGroup] as DataGridGroupItemAutomationPeer;
                        }
                        else
                        {
                            peer = new DataGridGroupItemAutomationPeer(cvGroup, this.OwningDataGrid);
                        }

                        if (peer != null)
                        {
                            DataGridRowGroupHeaderAutomationPeer rghPeer = peer.OwningRowGroupHeaderPeer;
                            if (rghPeer != null)
                            {
                                rghPeer.EventsSource = peer;
                            }
                        }

                        // This guards against the addition of duplicate items
                        if (!_groupItemPeers.ContainsKey(cvGroup))
                        {
                            _groupItemPeers.Add(cvGroup, peer);
                        }

#if FEATURE_ICOLLECTIONVIEW_GROUP
                        // Look for any sub groups
                        if (!cvGroup.IsBottomLevel)
                        {
                            int position = 0;
                            foreach (object subGroup in cvGroup.Items)
                            {
                                groups.Insert(position, subGroup);
                                position++;
                            }
                        }
#endif
                    }
                }
            }
        }
        protected override UICollectionReusableView GetGroupCell(UICollectionView collectionView, NSIndexPath indexPath, ICollectionViewGroup <object, object> group)
        {
            var header = collectionView.DequeueReusableSupplementaryView(UICollectionElementKindSection.Header, YouTubeHeaderIdentifier, indexPath) as YouTubeHeaderCell;

            header.Title.Text = group.Group.ToString().ToUpper();
            header.Title.Font = UIFont.SystemFontOfSize(UIFont.SmallSystemFontSize);
            return(header);
        }