开发者

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

开发者 https://www.devze.com 2023-03-24 23:28 出处:网络
Is there a way to get a scroll viewer with the RepeatButtons only and to force the buttons to the edge of the 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 cu开发者_如何学JAVAstom 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号