在visual studio中,我尝试使用visual c ++在MainPage中单击按钮,从一个页面导航到另一个页面

时间:2015-06-07 12:13:52

标签: windows-phone

void App16::MainPage::Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{

    this->Frame->Navigate(page2::typeid);
}

第2页未被识别。我不知道C ++中正确的语法应该是什么。

1 个答案:

答案 0 :(得分:0)

执行以下操作:

  1. 在MainPage.xaml.cpp的开头添加#include "page2.xaml.h"

  2. 添加using namespace Windows::UI::Xaml::Interop;以使您能够使用TypeName struct。

  3. 在按钮单击事件中,使用以下代码导航页面。 this->Frame->Navigate(TypeName(page2::typeid));