[U8.1]我们如何在手机和手机的通用Windows 8.1应用程序中使用共享代码?其他Windows设备? [英] [U8.1]How can we Use shared code in universal windows 8.1 application for both phone & other windows devices?

查看:60
本文介绍了[U8.1]我们如何在手机和手机的通用Windows 8.1应用程序中使用共享代码?其他Windows设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Windows 8.1开发的新手


我创建了一个示例通用Windows 8.1项目 


file-> new- >项目 - > C# - > Windows->通用 - >空白应用 - >创建名称 - >单击"确定",三个项目显示一个用于Windows 8.1设备,一个用于Windows 8.1手机,一个用于共享,


我右键单击共享项目添加 - >新项目 - > BlackPage->添加 - >该页面已打开


对其进行了一些控制....


我正在运行 但它显示黑屏无控件显示在哪里?如何在Windows Phone 8.1模拟器和其他Windows 8.1模拟器中看到控件



请为此提供解决方案

解决方案

Hi cto_ardent



请问您的App.xaml.cs文件?有一个行代码用于
设置应用程序启动时应用程序将导航到的目标页面。


它看起来像这样:



 if(!rootFrame.Navigate(typeof(MainPage),e.Arguments))
{
throw new Exception("无法创建初始页面");
}






您可以将typeof(页面)更改为您创建的页面,请参阅以下
代码:

 if(!rootFrame.Navigate(typeof(BlankPage1),e.Arguments))
{
throw new Exception ("无法创建初始页面");
}







BlankPage1是我创建的页面,您可以将名称更改为您创建的页面。


然后你可以运行它并查看你想要的页面显示。



最好的问候,


罗伊


I am new in Windows 8.1 development

i created a sample universal windows 8.1 project 

file->new->Project->C#->Windows->Universal->Blank App->create name-> click Ok  , the Three projects is shown one for windows 8.1 devices ,and one for windows 8.1 phone ,and one for Shared,

I right click on the shared project Add->New Item-> BlackPage->Add-> The page is open

put some controls on it....

and i run  But it shows a black screen no controls where shown ? how can i see the controls in Both Windows Phone 8.1 simulator and other windows 8.1  simulators

Please give a solution for this 

解决方案

Hi cto_ardent

Could you please check your App.xaml.cs file? There is one line code that used to set the target page which the app will navigate to when the app is launch.

It looks like this:

  if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }


You could change the typeof(page) to the page you created, please refer the following code:

  if (!rootFrame.Navigate(typeof(BlankPage1), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }


BlankPage1 is the page I created, you could change the name to the page you created.

Then you could run it and see the page you want to show.

Best regards,

Roy


这篇关于[U8.1]我们如何在手机和手机的通用Windows 8.1应用程序中使用共享代码?其他Windows设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆