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); } }
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); }
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); } }