![](/img/trans.png)
[英]How to set the scrollviewer size to the parent's grid size in wpf
[英]Set the scrollable area size of WPF's scrollviewer
我使用ScrollViewer
能夠滾動scrollviewer中的內容。 現在,我還需要能夠縮放內容,並且使用RenderTransform
縮放內容,但是ScrollViewer
無法識別縮放的內容(可滾動區域不會增長)。
如何手動計算並設置ScrollViewer
的可滾動區域? 讓我們坐下來,即使內容只有100 x 100像素,我還是希望可滾動區域像1000 x 1000像素。
如果要ScrollViewer容納縮放的內容,只需設置內容的LayoutTransform而不是其RenderTransform。 關鍵區別在於,在測量和排列過程中會考慮LayoutTransform的效果,聽起來這正是您想要的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.