Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF XAML Parse Exception occured Error?

Tags:

c#

mvvm

wpf

xaml

 <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">

I am working on a C# WPF Applcation i am implementing it using MVVM .My Application shows splash screen at first which appears fine but after that i want EULA(End user license agreement) Window when i try to execute it shows an exception as "XAML Parse Exception "Provide value on 'System.Windows.Markup.StaticExtension' threw an exception" by locating towards the above code.

Following is my C# code from where i am calling EULA..Please help me as i have tried my all ways in removing this exception.?

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();
}
like image 412
TheSpy Avatar asked Jan 28 '14 08:01

TheSpy


1 Answers

Given your error:

"XAML Parse Exception "Provide value on 'System.Windows.Markup.StaticExtension' threw an exception"

I think your problems lies in this line:

Title="{x:Static res:Strings.WizardWelcomeWindow_Title}"

which is where the StaticExtension is used.

Make sure that your Strings.resx is public by going to its properties and checking that Custom Tool is set to PublicResXFileCodeGenerator (and not ResXFileCodeGenerator, which is the default) - you can either directly edit it there or through the Access Modified combobox in the designer when you open the resources file.

like image 194
jnovo Avatar answered Oct 26 '22 23:10

jnovo