protected override void Update() { base.Update(); float currentScroll = scrollContainer.Current; if (currentScroll != lastKnownScroll) { lastKnownScroll = currentScroll; OptionsSection bestCandidate = null; float bestDistance = float.MaxValue; foreach (OptionsSection section in sections) { float distance = Math.Abs(scrollContainer.GetChildYInContent(section) - currentScroll); if (distance < bestDistance) { bestDistance = distance; bestCandidate = section; } } var previous = sidebarButtons.SingleOrDefault(sb => sb.Selected); var next = sidebarButtons.SingleOrDefault(sb => sb.Section == bestCandidate); if (next != null) { previous.Selected = false; next.Selected = true; } } }