折叠TabControl中的第一个Tabitem [英] Collapse the first Tabitem in a TabControl

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

问题描述

大家好,





我有一个对象列表(Say'Foo'对象),它被设置为ItemsSource of一个TabControl。我需要做的是隐藏此选项卡控件中第一个选项卡的标题。

完成此操作的最佳方法是什么?



这可以通过为TabItem设置样式来实现,但是如何指定只折叠第一个Tab的标题,而剩下的Tabs标题应保持原样。



感谢您的帮助

Hi All ,


I have a list of objects (Say 'Foo' objects) which is set as the ItemsSource of a TabControl. What I need to do is to hide the header of the first tab inside this tab control.
What's the best way to accomplish this?

This can perhaps be achieved by setting a style for a TabItem but how do I specify that only the first Tab's header is to be collapsed whereas the remaining Tabs header should be left as is.

Thanks for any help

推荐答案

Hello Hellraiser123



您可以选择第一个TabItem TabControl并将其可见性设置为已折叠。

结果是TabControl在显示其他TabItem时忽略了第一个TabItem。



代码如下所示:

Hello Hellraiser123

You can select the first TabItem of the TabControl and set it's visibility to "collapsed".
The result of this would be that the TabControl just ignores the first TabItem while it displays the others.

The code looks like the following:
((TabItem)tabCtrl.Items[0]).Visibility = System.Windows.Visibility.Collapsed; 





其中tabCtrl是TabControl的名称。



Where tabCtrl is the name of your TabControl.


这篇关于折叠TabControl中的第一个Tabitem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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