Пример #1
0
 protected override void PrepareMeasureContainers()
 {
     if (CurrentContainerView != null)
     {
         CurrentContainerView.Measure(Size.Empty);  // Available size is ignored when preparing blocks
     }
 }
Пример #2
0
        private Size FinalizeMeasure()
        {
            foreach (var scalarBinding in ScalarBindings)
            {
                // Resizing auto size binding should invalidate measure, the binding should only be measured with infinity length, which was done in previous PrepareMeasure.
                if (scalarBinding.IsAutoSize)
                {
                    continue;
                }

                for (int i = 0; i < scalarBinding.FlowRepeatCount; i++)
                {
                    var element = scalarBinding[i];
                    element.Measure(GetSize(scalarBinding));
                }
            }

            if (IsCurrentContainerViewIsolated)
            {
                CurrentContainerView.Measure(GetSize(CurrentContainerView));
            }

            for (int i = 0; i < ContainerViewList.Count; i++)
            {
                var containerView = ContainerViewList[i];
                containerView.Measure(GetSize(containerView));
            }

            return(MeasuredSize);
        }
Пример #3
0
        private void OnFlowRepeatCountChanged(int flowRepeatCountDelta)
        {
            Debug.Assert(flowRepeatCountDelta != 0);

            ContainerViewList.VirtualizeAll();

            var index          = -1;
            var delta          = 0;
            var scalarBindings = Template.InternalScalarBindings;

            if (flowRepeatCountDelta > 0)
            {
                Debug.Assert(flowRepeatCountDelta < FlowRepeatCount);
                BeginSetup(scalarBindings, FlowRepeatCount - flowRepeatCountDelta);
            }
            for (int i = 0; i < scalarBindings.Count; i++)
            {
                index++;
                if (i == Template.ScalarBindingsSplit && CurrentContainerView != null)
                {
                    index += 1;
                }
                var scalarBinding = scalarBindings[i];

                var prevCumulativeFlowRepeatCountDelta = i == 0 ? 0 : scalarBindings[i - 1].CumulativeFlowRepeatCountDelta;
                if (!scalarBinding.RepeatsWhenFlow)
                {
                    scalarBinding.CumulativeFlowRepeatCountDelta = prevCumulativeFlowRepeatCountDelta + (FlowRepeatCount - 1);
                    continue;
                }
                scalarBinding.CumulativeFlowRepeatCountDelta = prevCumulativeFlowRepeatCountDelta;

                if (i < Template.ScalarBindingsSplit)
                {
                    delta += flowRepeatCountDelta;
                }

                if (flowRepeatCountDelta > 0)
                {
                    index = InsertScalarElementsAfter(scalarBinding, index + FlowRepeatCount - flowRepeatCountDelta - 1, flowRepeatCountDelta);
                }
                else
                {
                    RemoveScalarElementsAfter(scalarBinding, index += FlowRepeatCount - 1, -flowRepeatCountDelta);
                }
            }

            if (flowRepeatCountDelta > 0)
            {
                EndSetup(scalarBindings);
            }

            HeadScalarElementsCount += delta;

            if (CurrentContainerView != null)
            {
                CurrentContainerView.ReloadCurrentRow(CurrentRow);
            }
        }
Пример #4
0
        private void PreventCurrentRowViewFromLosingFocus(RowView newFocusedRowView)
        {
            // Focus management is tricky, we choose not to manage focus at all:
            // instead of setting focus back to current RowView, we reload CurrentRow
            // to the newly focused RowView.
            var oldValue = newFocusedRowView.RowPresenter;

            UpdateCurrentContainerView(newFocusedRowView);
            ContainerViewList.VirtualizeAll();
            CurrentContainerView.ReloadCurrentRow(oldValue);
        }
Пример #5
0
 private void RefreshContainerViews()
 {
     if (CurrentContainerView != null && CurrentContainerViewPlacement != CurrentContainerViewPlacement.WithinList)
     {
         CurrentContainerView.Refresh();
     }
     foreach (var containerView in ContainerViewList)
     {
         containerView.Refresh();
     }
 }
Пример #6
0
        protected override void OnRowsChanged()
        {
            if (_focusTo != null)
            {
                SetCurrentRowFromView();
            }

            // when oldCurrentRow != CurrentRow, CurrentContainerView should have been reloaded in OnCurrentRowChanged override
            var oldCurrentRow = CurrentRow;

            ContainerViewList.VirtualizeAll(); // must VirtualizeAll before calling base.OnRowChanged where CurrentRow might be changed.
            base.OnRowsChanged();
            if (CurrentContainerView != null && oldCurrentRow == CurrentRow && CurrentContainerView.AffectedOnRowsChanged)
            {
                CurrentContainerView.ReloadCurrentRow(CurrentRow);
            }
        }