简体   繁体   中英

WPF "overlapping" scroll viewer

I have a WPF Grid with 3 "sections": 1, 2, and 3.

When Horizontal (H) is moved, I need 1 and 3 to move.

When Vertical (V) is moved, I need 2 and 3 to move.

Is this possible with such a layout to use a ScrollViewer, or am I looking for a more complex solution?

Thanks.

在此处输入图片说明

Answer found after some messing around.

  • wrap 1, 2, 3 in ScrollView controls
  • set (3) H and V ScrollBars to "Auto"
  • set (1) and (2) ScrollBars to "Hidden"
  • subscribe to (3) "ScrollChanged" event
  • set (2) ScrollToVerticalOffset() with (3).VerticalOffset
  • set (1) ScrollToHorizontalOffset() with (3).HorizontalOffset

Thanks Synchronized scrolling of two ScrollViewers whenever any one is scrolled in wpf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM