【发布时间】:2014-01-12 19:07:55
【问题描述】:
我需要在 MainWindow 中创建一个 TabControl,然后我需要在 MainWindow 中创建一个返回该 TabControl 的属性。我不知道如何从另一个窗口访问 TabControl,因为当我这样尝试时,它会显示“需要对象引用 bla bla ...”:
MainWindow.tabcontrol.Items.Add("tabitem");
我在 MainWindow 中创建的属性是:
public TabControl tabcontrol
{ get { return tabc; } set{ tabc = value;} }
值是:
"tabcontrol" is name of Property
"tabc" is name of TabControl that I need in another window
请问,我该怎么做?如何从另一个窗口将项目添加到 MainWindow 中的 TabControl?
此代码返回错误:“需要对象引用...”
【问题讨论】:
-
发布您的 xaml + 退出代码。
标签: .net wpf tabcontrol