如何在运行时将内容插入Tabitems

编程入门 行业动态 更新时间:2024-10-28 08:25:24
本文介绍了如何在运行时将内容插入Tabitems的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Heya, 我在应用程序中添加了一个带有一个(单个)Tabitem且内部带有文本框的Tabcontrol.现在,如果我要使用以下内容创建一个新标签: CHead.Items.Add(item); 新标签将为空.如何将其他元素插入此选项卡或将其他选项卡的内容应用于其中(在运行时)? 在此先感谢

Heya, I added a Tabcontrol with a (single) Tabitem with a textbox inside, into my application. Now if I would create a new tab with: CHead.Items.Add(item); The new tab will be empty. How do I insert other elements into this tab or apply the content from another tab into it (at runtime)? Thanks in advance

推荐答案

您需要查看Tabitems的TabControl项目集合 您可以添加另一个并设置其内容,例如如果我有一个带有1个选项卡页的选项卡控件,则在该选项卡页上单击一个按钮,在单击事件中可以; You need to look at the TabControl items collection for the tabitems You can add another and set its content, e.g. if I have a tabcontrol with 1 tab page, on that tab page a button, in the click event you could; private void button1_Click(object sender, RoutedEventArgs e) { TabItem newTab = new TabItem(); newTab.Header = "Another Tab"; newTab.Content = new TextBox(); tabControl1.Items.Add(newTab); }

更多推荐

如何在运行时将内容插入Tabitems

本文发布于:2023-11-12 07:55:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580935.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时将   内容   如何在   Tabitems

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!