[英]Multi-page application in Silverlight for Windows Embedded 7
I'm trying to develop an application in Silverlight for Windows Embedded 7, which uses C++. 我正在尝试在Silverlight中为Windows Embedded 7开发一个使用C ++的应用程序。
I was able to run a simple page with a button, which calls another function (a simple Hello world message box). 我能够用一个按钮运行一个简单的页面,该按钮调用另一个函数(一个简单的Hello world消息框)。
The great question here is: how can I make a function display another page, defined in another XAML file? 这里最大的问题是:如何使函数显示另一个XAML文件中定义的另一个页面? All the examples I found online, and even in Microsoft resources, uses a single XAML file with everything done inside it.
我在网上甚至在Microsoft资源中找到的所有示例都使用一个XAML文件,其中所有内容都在其中完成。
Thanks in advance! 提前致谢!
I'm a student who is suffering from the same problem now. 我是一个现在正遭受同样问题困扰的学生。 Hope there's someone to help us solve it.
希望有人帮助我们解决问题。
I have searched and found that FRAME is not supported in the SWE. 我搜索后发现SWE不支持FRAME。
I have found an alternative way to solve this problem but I'm not familiar with C++ code. 我找到了解决此问题的另一种方法,但我对C ++代码不熟悉。 If you knows how to program in C++, would you please read through this and teach me a bit?
如果您知道如何用C ++编程,请您仔细阅读一下并教我一点吗? Thanks so much.
非常感谢。
You can search for"Create a Custom User Control in Silverlight for Windows Embedded". 您可以搜索“在用于Windows Embedded的Silverlight中创建自定义用户控件”。 You'll found a PDF file released by Microsoft.
您会找到Microsoft发布的PDF文件。 With this way you can create a custom user control to hold your "multi page".
通过这种方式,您可以创建一个自定义用户控件来保存“多页”。 I have done this step, and with the control I created, I am able to "hide" and "show" it in order to achieve the "multipage" effect.
我已经完成了这一步,并使用我创建的控件,可以“隐藏”和“显示”它,以实现“多页”效果。
In my User Control, I have some more buttons to let users to click. 在我的用户控件中,我还有一些按钮可供用户单击。 However, from the mainpage which hosting the user control, the buttons inside cannot be detect.
但是,从托管用户控件的主页上,无法检测到其中的按钮。
In the PDF tutorial they teach how do we call out the methods in the custom control, but I don't understand the C++ code. 在PDF教程中,他们教我们如何在自定义控件中调用方法,但我不理解C ++代码。
If you can get the user control done make the controls in your custom control function correctly, would you please tell me? 如果您可以完成用户控件,请在自定义控件功能中正确设置控件,请您告诉我吗? thank you.
谢谢。
To do multi-page applications, you need multiple xaml files. 要进行多页应用程序,您需要多个xaml文件。 Not sure what the Microsoft tutorials you found were referencing, but i am developing an application now which has more than 20 different pages or screens.
不知道您找到的Microsoft教程引用了什么,但是我现在正在开发一个应用程序,该应用程序具有20多个不同的页面或屏幕。 You need to design the layouts in XAML/ExpressionBlend and then using event handlers and pointers to the XAMl, implement the views in the C++ source code.
您需要在XAML / ExpressionBlend中设计布局,然后使用事件处理程序和指向XAM1的指针在C ++源代码中实现视图。
// ============================================================================
// LockDataLogger_Click
//
// Description: Event handler implementation
//
// Parameters: pSender - The dependency object that raised the click event.
// pArgs - Event specific arguments.
// ============================================================================
HRESULT MainPage::LockDataLogger_Click (IXRDependencyObject* pSender, XRMouseButtonEventArgs* pArgs)
{
HRESULT hr = E_NOTIMPL;
if ((NULL == pSender) || (NULL == pArgs))
{
hr = E_INVALIDARG;
}
//m_pDeviceSettings_Lang->m_pYear->Focus(false);
if(m_pDeviceSettings_Lang)
{
m_pDeviceSettings_Lang->m_pYear->SetIsDropDownOpen(false);
}
m_pLoginScreen->SetVisibility(XRVisibility_Visible);
m_pLogin_Password->SetPassword(L"");
m_pHome_LoginOptions->SetVisibility(XRVisibility_Collapsed);
return hr;
}
So this is an event handler implementation for when you clock the "Lock" button on the home screen of my device. 因此,这是一个事件处理程序实现,用于当您在设备主屏幕上计时“锁定”按钮时。 All you need to do is name your different pages/menus accordingly and based on event handler implementations, using points, set/change the visibility of the different pages.
您需要做的就是相应地命名不同的页面/菜单,并基于事件处理程序的实现,使用点设置/更改不同页面的可见性。 Very straightforward and hope the example code provides some insight.
非常简单,希望示例代码能够提供一些见识。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.