在TabControl中滚动TabItem [英] Scrolling TabItems in a TabControl

查看:90
本文介绍了在TabControl中滚动TabItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义选项卡控件,该控件已在controlTemplate中定义,其中包含用于内容的区域,以及一个StackPanel,用于显示TabItems. StackPanel包装在ScrollViewer中,因此当用户打开太多TabItem时,他们可以向左和向右滚动选项卡.问题是,我希望左侧有一个特殊的选项卡,该选项卡不滚动并且始终停留在同一位置.基本上,我想将其从ScrollViewer中排除.如何做到这一点? StackPanel是"itemshost".因此制表符控件将始终尝试将其制表项放在其中.如果仅在控件模板中的滚动查看器外部放置一个单独的tabitem,则tab控件不会将其视为标签,也不会选择它或显示其内容.

任何帮助将不胜感激.

I have a custom tab control that I have defined in a controlTemplate with an area for the content, and a StackPanel to display the TabItems.  The StackPanel is wrapped in a ScrollViewer so when the user opens too many TabItems, they can scroll the tabs to the left and right.  The problem is, I want there to be one special tab on the left hand side that does not scroll and always stays in the same spot.  Basically I want to exclude it from the ScrollViewer.  How can this be accomplished?  The StackPanel is the "itemshost" so the tab control will always try to place its tabitems inside it.  If I just stick a separate tabitem outside the scrollviewer in the controltemplate, the tab control doesn't see it as a tab, and won't select it or display its content. 

Any help would be appreciated.

推荐答案

如何关于在ScrollViewer外部添加一个单独的TabItem,并处理其MouseDown事件.在事件处理程序中,将TabControl的显示内容设置为此TabItem的内容吗?


这篇关于在TabControl中滚动TabItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆