Share via


WPF Scrolling Performance Tip: Avoid using ScrollBarVisibility=Auto

When you can, avoid using the ScrollBarVisibility value "Auto" for HorizontalScrollBarVisibility and/or VerticalScrollBarVisibility.  These properties show up on ScrollViewer, TextBox , RichTextBox and ListBox (although, as an attached property on the last.)  Instead, use "Visible", "Disabled" or "Hidden."

The "Auto" value is intended for cases when space is limited and ScrollBars should only be displayed when necessary.  For example, it may be useful with a ListBox of 30 items as opposed to a TextBox with hundreds of lines or more of text.

Comments