在 WPF TabItem 标头中显示动态数字
我有一个 TabControl,其中每个项目都包含一个名为“时间轴”的用户控件。该“时间轴”有一个名为“Number”的属性,该属性在运行时会发生变化。
我想让属性“Number”显示在 TabItem 标题中。说实话,我真的不知道该怎么做。
我的第一个想法是,我必须创建一个派生自原始 TabItem 控件的自定义控件,并使用自定义 ControlTemplate 创建 DependencyProperty 或其他内容。
我觉得我很难解释这一点...
举个例子:我想在以下网址上做类似帖子中的第三张图片的操作,但我想显示属性“Number”,而不是关闭按钮在运行时动态变化!
http://geekswithblogs.net/kobush/archive/2007/04/08 /closeabletabitem.aspx
I have a TabControl where every item contains a User Control called Timeline. This "Timeline" has a property called "Number" which changes during runtime.
I want to make the property "Number" to be displayed in the TabItem header. And i have really no idea how to do that to be honest.
My first thought is that i have to create a Custom Control that derives from the original TabItem Control and create a DependencyProperty or something with a custom ControlTemplate.
I feel that i'm pretty bad on explaining this...
An example: I Want to do something like the third image in the post on following url, but instead of the close-button, i want to display the property "Number" that dynamically changes during runtime!
http://geekswithblogs.net/kobush/archive/2007/04/08/closeabletabitem.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我们有这个类:
我们可以将项目集合绑定到 TabControl:
If we have this class:
We can bind the collection of items to TabControl: