7
 <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();
}
Fresh Saint
  • 139
  • 2
  • 12
TheSpy
  • 265
  • 1
  • 8
  • 21

1 Answers1

34

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.

jnovo
  • 5,659
  • 2
  • 38
  • 56
  • But it generates another error as follows : "The invocation of the constructor on type 'AFICController.EULA' that matches the specified binding constraints threw an exception." – TheSpy Jan 28 '14 at 08:50
  • Anyone have idea about this ?? – TheSpy Jan 28 '14 at 08:50
  • You should debug the constructor of your `AFICController.EULA` Window. The exception probably offers you some more information. If you can't solve it, I'd suggest you post a new question with the relevant code and exception. – jnovo Jan 28 '14 at 08:58
  • Or you can change "Access Modifier" to "Public" when *.resx is opened in designer, which has same effect but (at least to me) involves less "magic". – sluki Nov 25 '15 at 10:06
  • @sluki can't believe I missed that. Editing the answer right away, thanks. – jnovo Nov 25 '15 at 10:12
  • 1
    You saved the day. Thank you. – James Westgate Apr 12 '21 at 10:05