WPF XAML Parse异常发生错误?

The*_*Spy 6 c# wpf xaml mvvm

 <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            x:Class="AFICController.EULA"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:res="clr-namespace:AFICController.Resources"
            Title="{x:Static res:Strings.WizardWelcomeWindow_Title}"
            Width="800"
            Height="600"  
            WindowStartupLocation="CenterScreen"
            Icon="/AFICController;Component/Resources/Images/att_icon.ico"
            ResizeMode="NoResize">
Run Code Online (Sandbox Code Playgroud)

我正在开发一个C#WPF Applcation我正在使用MVVM实现它.我的应用程序首先显示启动画面,看起来不错,但之后我想要EULA(最终用户许可协议)窗口,当我尝试执行它时显示异常为"XAML解析异常"在'System.Windows.Markup.StaticExtension'上提供值"通过定位上面的代码引发异常.

以下是我调用EULA的C#代码.请帮助我,因为我已经尝试了所有方法来删除此异常.

class App : Application
{
[STAThread()]
static void Main()
{
  Splasher.Splash = new SplashScreen();
  Splasher.ShowSplash();

  Mouse.OverrideCursor = null;

  for (int i = 0; i < 5000; i++)
  {
    Thread.Sleep(1);
  }

  Splasher.CloseSplash();
  new App();
}
/// <summary>
/// 
/// </summary>
public App()
{

  App.Current.Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new       Uri(@"\Resources\Dictionary\ATTColors.xaml", UriKind.Relative) });

  App.Current.Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri(@"\Resources\Dictionary\AppButton.xaml", UriKind.Relative) });

  Console.WriteLine("EULA Opened");
  StartupUri = new System.Uri("EULA.xaml", UriKind.Relative);

  //StartupUri = new System.Uri("View/WizardDialog.xaml", UriKind.Relative);


  Run();
}
Run Code Online (Sandbox Code Playgroud)

jno*_*ovo 30

鉴于你的错误:

"XAML Parse Exception"为'System.Windows.Markup.StaticExtension'提供了一个异常"

我认为你的问题在于这一行:

Title="{x:Static res:Strings.WizardWelcomeWindow_Title}"
Run Code Online (Sandbox Code Playgroud)

StaticExtension是使用的地方.

Strings.resx通过转到其属性并确认自定义工具设置为PublicResXFileCodeGenerator(而不是ResXFileCodeGenerator默认设置)来确保您是公共的- 您可以在那里直接编辑它,也可以Access Modified在打开资源文件时通过设计器中的组合框进行编辑.