从mainpage c#到达usercontrol c#中的方法#

时间:2018-05-28 09:47:43

标签: c# uwp

在我的uwp项目中,我有一个User Control,我有一个房间的模板,但是在Mainpage.cs我得到了API的所有值。

在模板中,我有多个x:names,我无法访问Mainpage.cs文件。因为我已经在我的UserControl.cs中发挥了作用。

这是我想在UserControl.cs中引用的方法Mainpage.cs中的示例代码:

public void OnBooked()
{
    //do stuff...
}

UserControl.cs中的班级名为TemplateGrid

我试图做这样的事情,但它似乎没有效果:

TemplateGrid.OnBooked();

我的问题是如何在OnBooked()中引用方法Mainpage.cs

提前致谢!

0 个答案:

没有答案
相关问题