예제 #1
0
        //-------------------------------------------------------------------
        //
        // Private Methods
        //
        //-------------------------------------------------------------------

        #region Private Methods

        private void FindViewPort()
        {
            // assume GridViewRowPresenter is in Item's template
            _viewItem = this.TemplatedParent as FrameworkElement;

            if (_viewItem != null)
            {
                ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(_viewItem) as ItemsControl;

                if (itemsControl != null)
                {
                    ScrollViewer scrollViewer = itemsControl.ScrollHost as ScrollViewer;
                    if (scrollViewer != null)
                    {
                        // check if Virtualizing Panel do works
                        if (itemsControl.ItemsHost is VirtualizingPanel &&
                            scrollViewer.CanContentScroll)
                        {
                            // find the 'PART_ScrollContentPresenter' in GridViewScrollViewer
                            _viewPort = scrollViewer.GetTemplateChild(ScrollViewer.ScrollContentPresenterTemplateName) as FrameworkElement;

                            // in case GridViewScrollViewer is re-styled, say, cannot find PART_ScrollContentPresenter
                            if (_viewPort == null)
                            {
                                _viewPort = scrollViewer;
                            }
                        }
                    }
                }
            }
        }
 // Token: 0x06004DAA RID: 19882 RVA: 0x0015E428 File Offset: 0x0015C628
 private void FindViewPort()
 {
     this._viewItem = (base.TemplatedParent as FrameworkElement);
     if (this._viewItem != null)
     {
         ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(this._viewItem);
         if (itemsControl != null)
         {
             ScrollViewer scrollHost = itemsControl.ScrollHost;
             if (scrollHost != null && itemsControl.ItemsHost is VirtualizingPanel && scrollHost.CanContentScroll)
             {
                 this._viewPort = (scrollHost.GetTemplateChild("PART_ScrollContentPresenter") as FrameworkElement);
                 if (this._viewPort == null)
                 {
                     this._viewPort = scrollHost;
                 }
             }
         }
     }
 }