wp7 xamlparseexception initializecomponent

时间:2012-11-09 20:50:14

标签: windows-phone-7 xaml xamlparseexception

我有一个奇怪的问题。我开发了一个Windows Phone 7应用程序。首先,它的目标Windows Phone OS版本设置为7.0(在项目属性中)。一切都很好。

但是,在将目标操作系统升级到版本7.1后,我得到一个异常:XamlParseException“[Line:0 Position:0]”。此方法中的LoginPage.g.i.cs中发生异常:

[System.Diagnostics.DebuggerNonUserCodeAttribute()]
    public void InitializeComponent() {
        if (_contentLoaded) {
            return;
        }
        _contentLoaded = true;
        System.Windows.Application.LoadComponent(this, new System.Uri("/BCMLogic;component/Pages/LoginPage.xaml", System.UriKind.Relative));
        this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
        this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
        this.image1 = ((System.Windows.Controls.Image)(this.FindName("image1")));
        this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
        this.loginBtn = ((System.Windows.Controls.Button)(this.FindName("loginBtn")));
        this.userNameTxt = ((System.Windows.Controls.TextBox)(this.FindName("userNameTxt")));
        this.passTxt = ((System.Windows.Controls.PasswordBox)(this.FindName("passTxt")));
        this.clientTxt = ((System.Windows.Controls.TextBox)(this.FindName("clientTxt")));
        this.user = ((System.Windows.Controls.Image)(this.FindName("user")));
        this.passwd = ((System.Windows.Controls.Image)(this.FindName("passwd")));
        this.welcome = ((System.Windows.Controls.Image)(this.FindName("welcome")));
        this.client = ((System.Windows.Controls.Image)(this.FindName("client")));
        this.progressOverlay = ((Coding4Fun.Phone.Controls.ProgressOverlay)(this.FindName("progressOverlay")));
    }
}

}

错误显示在行中:this.LayoutRoot =((System.Windows.Controls.Grid)(this.FindName(“LayoutRoot”)));

我在LoginPage.xaml中的主网格如下所示:

<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

 ....

</Grid>

内部异常为空,所以我在那里得不到任何信息。这是否与项目dlls引用的事实与我将项目升级到的OS版本兼容的事实有所不同?我该如何检查?我花了一些时间浏览其他帖子,但却找不到符合我问题的解决方案。

提前感谢您的帮助:)

0 个答案:

没有答案