When the TreeView's ScrollViewer is Visible, changing the tree's width to 0 them back to Auto breaks the scrolling function of the ScrollViewer. The workaround is to make the TreeView Collapsed before setting the Width to 0 and make it Visible before setting the Width back to Auto. Another workaround: Use visibility instead of Width=0.