简体   繁体   中英

C# WPF horizontal scrollbar for ScrollViewer RepeatButtons only on either side of contents

Is there a way to get a scroll viewer with the RepeatButtons only and to force the buttons to the edge of the contents?

I want it to look like this:

  +---+-------------------------------------------------------------+---+
  |   |                                                             |   |
  | < | Contents here...............................................| > |
  |   |                                                             |   |
  +---+-------------------------------------------------------------+---+

Where the middle is the content of the ScrollViewer, and the left and right are RepeatButtons which will scroll the contents.

I was thinking I could either use a custom ScrollBar (but I don't know much about this or how to make the buttons go outside the content), or I could just use RepeatButtons and connect their click to the ScrollViewer. Which way (if either) would be better/easier?

I see no reason you cannot use a ScrollViewer . Configure the event handlers of your two arrows (left/right) to minipulate ScrollToHorizontalOffset() and ScrollToVerticalOffset .

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