开发者

How to calculate full height of a scroll viewer

开发者 https://www.devze.com 2022-12-24 17:39 出处:网络
I am using a scroll viewer in my xaml page. When i display lot of entries in this viewer it starts showing a scroll bar which is fine and desirable. But while exporting that page in jpeg format i need

I am using a scroll viewer in my xaml page. When i display lot of entries in this viewer it starts showing a scroll bar which is fine and desirable. But while exporting that page in jpeg format i need to show all entries in one image. Hence i am planning to increase its size just enough to make scroll bar disappear. Chalange i am facing with this is that i can not calculate exactly how much do i need to increase its height so that it can accomodate all entries without showing scroll 开发者_如何学Gobar. Thanks in advance.

-- Lalit


Have you tried if ViewportHeight / ViewportWidth or ScrollableHeight / ScrollableWidth suits your needs?

I would however suggest the following:

  • Set MinHeight, MinWidth.
  • Make sure both scrollbar visibility is set to Auto. By default it is Auto.
  • The scroll viewer will expand as much as it can & then only show the scrollbars.
  • The maximum size is defined by MaxHeight, MaxWidth.
  • The MaxHeight / MaxWidth is always lesser than equal to what the parent allows.


I believe you want ScrollViewer.ExtentWidth and ScrollViewer.ExtentHeight.

0

精彩评论

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