Exemplo n.º 1
0
 internal void InvalidatePinnedRows()
 {
     this.ViewElement.TopPinnedRows.DisposeChildren();
     this.ViewElement.BottomPinnedRows.DisposeChildren();
     if (this.ViewInfo.ShowHeaderRow)
     {
         this.ViewElement.TopPinnedRows.Children.Add((RadElement)this.RowScroller.ElementProvider.GetElement(-1, (object)null));
     }
     if (this.ViewInfo.ShowNewRow)
     {
         this.ViewElement.TopPinnedRows.Children.Add((RadElement)this.RowScroller.ElementProvider.GetElement(-2, (object)null));
     }
     if (this.ViewInfo.ShowFilterRow)
     {
         this.ViewElement.TopPinnedRows.Children.Add((RadElement)this.RowScroller.ElementProvider.GetElement(-3, (object)null));
     }
     foreach (int topPinnedItem in this.RowsViewState.TopPinnedItems)
     {
         VirtualGridRowElement element = (VirtualGridRowElement)this.RowScroller.ElementProvider.GetElement(topPinnedItem, (object)null);
         this.ViewElement.TopPinnedRows.Children.Add((RadElement)element);
         element.Attach(topPinnedItem, (object)null);
     }
     foreach (int bottomPinnedItem in this.RowsViewState.BottomPinnedItems)
     {
         VirtualGridRowElement element = (VirtualGridRowElement)this.RowScroller.ElementProvider.GetElement(bottomPinnedItem, (object)null);
         this.ViewElement.BottomPinnedRows.Children.Add((RadElement)element);
         element.Attach(bottomPinnedItem, (object)null);
     }
 }
        protected override IVirtualizedElement <int> UpdateElement(
            int position,
            int data)
        {
            if (this.tableElement == null)
            {
                return(base.UpdateElement(position, data));
            }
            object elementContext = this.GetElementContext();

            if (position < this.Children.Count)
            {
                IVirtualizedElement <int> element = (IVirtualizedElement <int>) this.Children[position];
                if (this.ElementProvider.ShouldUpdate(element, data, elementContext))
                {
                    if (this.tableElement.IsRowExpanded(data))
                    {
                        for (int indexFrom = position; indexFrom < this.Children.Count; ++indexFrom)
                        {
                            VirtualGridRowElement child = this.Children[indexFrom] as VirtualGridRowElement;
                            if (child != null && child.IsChildViewInitialized && child.IsCompatible(data, elementContext))
                            {
                                child.Detach();
                                child.Attach(data, elementContext);
                                if (indexFrom != position)
                                {
                                    this.Children.Move(indexFrom, position);
                                }
                                return((IVirtualizedElement <int>)child);
                            }
                        }
                        if ((this.ElementProvider as VirtualRowsElementProvider).TryGetElementWithChildView(data, elementContext, out element))
                        {
                            this.Children.Insert(position, (RadElement)element);
                            return(element);
                        }
                    }
                    else
                    {
                        for (int indexFrom = position; indexFrom < this.Children.Count; ++indexFrom)
                        {
                            VirtualGridRowElement child = this.Children[indexFrom] as VirtualGridRowElement;
                            if (child != null && !child.IsChildViewInitialized)
                            {
                                child.Detach();
                                child.Attach(data, elementContext);
                                if (indexFrom != position)
                                {
                                    this.Children.Move(indexFrom, position);
                                }
                                return((IVirtualizedElement <int>)child);
                            }
                        }
                        if ((this.ElementProvider as VirtualRowsElementProvider).TryGetElementWithoutChildView(data, elementContext, out element))
                        {
                            this.Children.Insert(position, (RadElement)element);
                            return(element);
                        }
                    }
                }
            }
            return(base.UpdateElement(position, data));
        }