开发者

How to give scroll bar to an WPF treeview [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_JS百科 Closed 11 years ago.

I have used the

<ScrollViewer CanContentScroll="True">
    <TreeView ...>
    </TreeView>
</ScrollViewer>

but not properly working I want a new one


TreeView manages its own scroll viewer. You'll want to set either ScrollViewer.HorizontalScrollBarVisibility or ScrollViewer.VerticalScrollBarVisiblity to Visible on the tree view itself to force the respective scrollbars to display.

<TreeView
  ScrollViewer.VerticalScrollBarVisibility="Visible"
  ScrollViewer.HorizontalScrollBarVisibility="Visible" />


Also, make sure your TreeView doesn't live inside a control that will extend vertically forever - a common mistake is this:

<StackPanel>
   <... />
      <TreeView>

In this example, the TreeView will grow longer and longer without scrolling, because the StackPanel has infinite height.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜