简体   繁体   English

Frame.Navigate到不同程序集中的XAML页面[WinRT]

[英]Frame.Navigate to a XAML Page in different assembly [WinRT]

I have these files. 我有这些文件。

"Control.cs" [this has method activateabc()] and "abc.xaml" in an assembly (created as a Class Library) and I have referred it in my working project(Windows Phone 8.1 Runtime App). “Control.cs”[这个方法有activateabc()]和程序集中的“abc.xaml”(创建为类库),我在我的工作项目(Windows Phone 8.1运行时应用程序)中引用了它。 I have added Frame.Navigate(typeof(abc)) within the activateabc() and when I call activateabc() from the working project it throws XAMLPARSEEXCEPTION. 我在activateabc()添加了Frame.Navigate(typeof(abc)) ,当我从工作项目中调用activateabc()时,它会抛出XAMLPARSEEXCEPTION。

Any idea how do I navigate to XAML page in another assembly? 任何想法如何导航到另一个程序集中的XAML页面? Also I have no dots or hypens or underscores in any of my assembly names. 此外,我的任何装配名称中都没有任何点或夸大或下划线。

Edit: NavigationService.Naivage() is available in Windows Phone 8 to do the job. 编辑: NavigationService.Naivage()在Windows Phone 8中可用于执行此任务。 However, Frame.Navigate() allows navigation to a type rather than to a URI as in WP8. 但是, Frame.Navigate()允许导航到类型而不是WP8中的URI。 So please tell me a way how to navigate to a XAML page in different assembly in Windows Phone 8.1 Runtime Apps 那么请告诉我如何在Windows Phone 8.1运行时应用程序中导航到不同程序集中的XAML页面

Can you provide more information please? 你能提供更多信息吗? I don't have an answer but I do have some additional information that might help. 我没有答案,但我确实有一些可能有帮助的其他信息。

Do you know if it's failing to parse the xaml markup or is it in truth failing to find the abc.xaml file? 你知道它是否无法解析xaml标记,或者它是否真的无法找到abc.xaml文件? I bet this is the real problem. 我敢打赌这是真正的问题。 If it's failing to find the file you might need to modify the xaml file Uri to include the assembly name. 如果找不到该文件,则可能需要修改xaml文件Uri以包含程序集名称。 I don't know how to override the default file load location for pages since that code gets generated but the Uri would look like this. 我不知道如何覆盖页面的默认文件加载位置,因为该代码生成但是Uri看起来像这样。

If your assembly is MyCustomControls.dll then the Uri would be new Uri("ms-appx:///MyCustomControls/abc.xaml"). 如果你的程序集是MyCustomControls.dll那么Uri将是新的Uri(“ms-appx:///MyCustomControls/abc.xaml”)。

If your xaml file is found but some markup is failing you might try to comment out all the markup until there is no load failure then comment it back in by bits until you isolate which bit of markup seems to be the problem. 如果找到你的xaml文件,但是某些标记失败,你可能会尝试注释掉所有标记,直到没有加载失败,然后逐位注释它,直到你发现哪个标记位似乎是问题。 It might be some namespace resolution issue in the app's xamltypeinfo.g.cs. 它可能是应用程序的xamltypeinfo.g.cs中的一些名称空间解析问题。 I doubt this is the issue though since you say you added the assembly as a reference. 我怀疑这是问题,因为你说你添加了程序集作为参考。

I hope some of the above information is useful. 我希望上面的一些信息是有用的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM