从 Main XAML 表单切换到第二个 XAML 表单的 C++ 代码是什么
What is the C++ code to switch from a Main XAML form to a second XAML form
我正在使用 visual studio 2015.
我正在创建一个有多个表单的应用程序,但我卡住了,因为我不知道切换页面的代码。
MainPage.cpp文件编码为=
//
// MainPage.xaml.cpp
// Implementation of the MainPage class.
//
#include "pch.h"
#include "MainPage.xaml.h"
#include "IncomeForm.xaml.h"
using namespace pman_project2;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
MainPage::MainPage()
{
InitializeComponent();
}
void pman_project2::MainPage::Income_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
??????????????????????????????????????
}
那一行问号是我卡住的地方。我在网上看过,它告诉我如何用 c# 而不是 c++ 来做。
显然 c# 中的代码是
this.Frame.navigate(typeof(page.IncomeForm));
有人能帮忙吗?
也是用这个方法,但是在C++/CX way:
Tip If you are programming using a .NET language (C# or Microsoft Visual Basic), the TypeName type projects as System.Type. When programming using C#, it is common to use the typeof operator to get references to the System.Type of a type. In Visual Basic, use GetType. If you're using C++/CX, where you'll need to create a TypeName helper struct, you can use the typeid component extension.
void pman_project2::MainPage::Income_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(IncomeForm::typeid));
}
高级用法请看this sample
分享我的样本,请查看:Link
我正在使用 visual studio 2015.
我正在创建一个有多个表单的应用程序,但我卡住了,因为我不知道切换页面的代码。
MainPage.cpp文件编码为=
//
// MainPage.xaml.cpp
// Implementation of the MainPage class.
//
#include "pch.h"
#include "MainPage.xaml.h"
#include "IncomeForm.xaml.h"
using namespace pman_project2;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
MainPage::MainPage()
{
InitializeComponent();
}
void pman_project2::MainPage::Income_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
??????????????????????????????????????
}
那一行问号是我卡住的地方。我在网上看过,它告诉我如何用 c# 而不是 c++ 来做。
显然 c# 中的代码是
this.Frame.navigate(typeof(page.IncomeForm));
有人能帮忙吗?
也是用这个方法,但是在C++/CX way:
Tip If you are programming using a .NET language (C# or Microsoft Visual Basic), the TypeName type projects as System.Type. When programming using C#, it is common to use the typeof operator to get references to the System.Type of a type. In Visual Basic, use GetType. If you're using C++/CX, where you'll need to create a TypeName helper struct, you can use the typeid component extension.
void pman_project2::MainPage::Income_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(IncomeForm::typeid));
}
高级用法请看this sample
分享我的样本,请查看:Link