示例#1
0
        private void GatesScroll_ScrollChanged(object sender, ScrollChangedEventArgs e)
        {
            if (e.VerticalChange != 0)
            {
                RegisterScroll.ScrollToVerticalOffset(e.VerticalOffset);
                GatesScroll.ScrollToVerticalOffset(RegisterScroll.VerticalOffset);
            }

            // if added step
            if (e.ExtentWidthChange > 0)
            {
                CircuitGridVM circuitVM   = DataContext as CircuitGridVM;
                int           addedColumn = circuitVM.LastStepAdded;
                if (addedColumn > 0)
                {
                    // if newly added step is not fully visible
                    double scrollNeeded = e.ExtentWidthChange * (addedColumn + 1) - GatesScroll.HorizontalOffset - GatesScroll.ViewportWidth;
                    if (scrollNeeded > 0)
                    {
                        GatesScroll.ScrollToHorizontalOffset(GatesScroll.HorizontalOffset + scrollNeeded);
                    }
                }
            }
        }
示例#2
0
 private void RegisterScroll_ScrollChanged(object sender, ScrollChangedEventArgs e)
 {
     GatesScroll.ScrollToVerticalOffset(e.VerticalOffset);
 }