Sunday, October 23, 2016

Automatic vertical scroll bar in WPF TextBlock?

<TextBox Name="myTextBox"
         TextWrapping="Wrap"
         ScrollViewer.HorizontalScrollBarVisibility="Auto"
         ScrollViewer.VerticalScrollBarVisibility="Auto"
         ScrollViewer.CanContentScroll="True">SOME TEXT
</TextBox>

"ScrollViewer currently allows two scrolling modes: smooth pixel-by-pixel scrolling (CanContentScroll = false) or discrete item-by-item scrolling (CanContentScroll = true). Currently WPF supports UI virtualization only when scrolling by item. Pixel-based scrolling is also called “physical scrolling” and item-based scrolling is also called “logical scrolling”

Reference:

http://stackoverflow.com/questions/1192335/automatic-vertical-scroll-bar-in-wpf-textblock

http://stackoverflow.com/questions/3724593/why-setting-scrollviewer-cancontentscroll-to-false-disable-virtualization

No comments: