如何导航到相同的解决方案在另一个项目 [英] How to navigate to another project inside same solution

查看:245
本文介绍了如何导航到相同的解决方案在另一个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿希望有人可以提供帮助。

Hey Hope somebody can help.

我在很多不同的项目开发组,我们现在要结合这些。因此,我包括项目。
在启动项目中,我包括参考其他项目。
然后我用code从另一个线程计算器:

I have in group developed on many different projects and we now want to combine these. I therefore include the projects. In the startup project I include the reference to the other projects. And then I use the code from another stackoverflow thread:

如何导航到另一个项目,查看

这给了我以下

    NavigationService.Navigate(new Uri("/MVVMTestApp;/component/View/MainPage.xaml", UriKind.Relative));

该项目建造和运行。但是,当我preSS的按钮会激活code我得到一个错误后/该行的执行过程中。

The project builds and runs. But when I press the button that should activate the code I get an error after/during the execution of the line.

突破误差位于MainPage.g.cs文件,该文件是这样的:

The break error is located in the MainPage.g.cs file which looks like:

namespace MVVMTestApp {


public partial class MainPage : Microsoft.Phone.Controls.PhoneApplicationPage {

    internal System.Windows.Controls.TextBlock MainPageTitle;

    internal System.Windows.Controls.TextBlock LEgE;

    private bool _contentLoaded;

    /// <summary>
    /// InitializeComponent
    /// </summary>
    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    public void InitializeComponent() {
        if (_contentLoaded) {
            return;
        }
        _contentLoaded = true;
        *******System.Windows.Application.LoadComponent(this, new System.Uri("/MVVMTestApp;component/View/MainPage.xaml", System.UriKind.Relative));**
        this.MainPageTitle = ((System.Windows.Controls.TextBlock)(this.FindName("MainPageTitle")));
        this.LEgE = ((System.Windows.Controls.TextBlock)(this.FindName("LEgE")));
    }
}
}

在这里我插在星线,是它打破了。什么我需要做的,使工作?

The line where I inserted the stars, is where it breaks. What do I need to do to make it work?

额外

由于在评论中说,我需要包括forwardslash/组件,因为它不是在任何地方使用,否则像上面的链接,此链接

As told in the comments, I need to include a forwardslash "/" before component, which is odd since it is not used in any place, else like the link above and this link

HTTP://www.geekchamp。 COM /提示/ WP7,导航到一个页面,在不同的组装

但包括forwardslash我得到不存在任何XAML文件,我指出错误。
剔除forwardslash,我得到一个XamlParseException发生......

But including the forwardslash I get an error that there does not exist any xaml file where I point. Excluding the forwardslash and I get a XamlParseException occured....

所以,我仍然有导航到另一个项目的看法的问题。

So I still have the problem of navigating to a view in another project.

ODD

我现在没有有分量的前领导forwardslash。只要我写MVVMTestAppAssembly。我看过的汇编文件,并不能找到这个包含=?

I now do not have to have the leading forwardslash before component. As long as I write MVVMTestAppAssembly. I have looked in the assembly files and cannot find this included =?

我试过了,在看MSDN后
http://msdn.microsoft.com/en -us /库/ cc296240%28V = VS.95%29.aspx

I tried it out after looking at msdn http://msdn.microsoft.com/en-us/library/cc296240%28v=vs.95%29.aspx

但仍然没有运气,与得到的导航工作。

But still no luck, with getting the navigation to work

的参考概述,并包括了完整路径元素

OVerview of reference and included the full path to the elements

一体化解决方案
作为一个答案表示一种解决方案是使用windows phone的类库。但是当我使用MVVM结构,我不能得到viewmodelLocator工作。因此,这不是我一个解决方案。

One Solution As stated in one answer one solution is to use the windows phone class library. But when I use MVVM structure, I cannot get the viewmodelLocator to work. Therefore, this is not a solution for me.

但是如果你使用MVVM,我需要另一种解决方案。希望有人有这种想法。
另一种解决方案
作为一个答案如下所述,您可以使用以下
方案1:

But if you use MVVM, I need another solution. Hopefully somebody has an idea for this. Another solution As stated below in an answer you can use the following Solution 1:

您使用相同类型的项目的Windows Phone应用程序。在该解决方案,你需要有一台Windows Phone应用程序工程等项目的类型应该为Windows Phone的类库。

You use the same type of projects "Windows Phone App". In the solution you need to have one Windows Phone App project and other projects should be of type Windows Phone Class Library.

然后就可以浏览查看与该行code的同一解决方案内的另一个项目:

Then you can navigate to view in another project inside same solution with this line of code:

    NavigationService.Navigate(new Uri("/MVVMTestApp;/component/View/MainPage.xaml", UriKind.Relative));

要在项目之间进行导航。但是你在它插入该行loadcomponent生成的XAML文件FILENAME.g.cs错误。因为观点被DataContext的连接到一个视图模型,据我可以理解出现的错误。我一直没能解决这个问题。

To navigate between projects. However you get an error in the generated xaml file FILENAME.g.cs where it inserts the line loadcomponent. The error occurs because of the view being connected by datacontext to a viewmodel, as far as I can understand. And I have not been able to solve it.

Hopfully某人有一个解决方案吗?

Hopfully somebody has a solution for this?

推荐答案

只是删除​​/,组件之前,像这样的:

Just remove "/" before "component", like this:

NavigationService.Navigate(新的URI(/ MVVMTestApp;组件/查看/ MainPage.xaml中,UriKind.Relative));

NavigationService.Navigate(new Uri("/MVVMTestApp;component/View/MainPage.xaml", UriKind.Relative));

这篇关于如何导航到相同的解决方案在另一个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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