WPF Scrolling Performance Tip: Avoid using ScrollBarVisibility=Auto

Published 14 August 06 09:19 AM | henryh 

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

# Kevin Dente said on August 14, 2006 11:55 PM:
Um...wouldn't Auto normally be the most common option? That's how listboxes in most Windows apps work, for example.
# henryh said on August 15, 2006 12:27 PM:
Yes, for a ListBox, this is commonly used.  In fact, the default for ListBox's HorizontalScrollBar is "Auto".  The effects of using "Auto" on a "small amount" of content should be relatively neglible.
# Boxing » Henry Hahn : WPF Scrolling Performance Tip: Avoid using … said on March 16, 2008 8:59 PM:

PingBack from http://boxingcarsblog.info/henry-hahn-wpf-scrolling-performance-tip-avoid-using/

# Cars » Henry Hahn : WPF Scrolling Performance Tip: Avoid using … said on March 22, 2008 10:13 PM:

PingBack from http://carsmaxblog.info/henry-hahn-wpf-scrolling-performance-tip-avoid-using/

# auto han performance said on July 25, 2008 12:17 AM:

PingBack from http://nicholashome.gratishotell.com/autohanperformance.html

# Henry Hahn WPF Scrolling Performance Tip Avoid using | fix my credit said on June 16, 2009 9:32 PM:

PingBack from http://fixmycrediteasily.info/story.php?id=1517

# Henry Hahn WPF Scrolling Performance Tip Avoid using | low cost car insurance said on June 17, 2009 12:50 AM:

PingBack from http://lowcostcarinsurances.info/story.php?id=349

Anonymous comments are disabled

About henryh

Henry works in the .Net Developer Platform group at Microsoft.

Search

This Blog

Tags

Syndication

Page view tracker