[英]WPF XAML Parse Exception occured Error?
<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">
我正在開發一個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();
}
鑒於你的錯誤:
“XAML Parse Exception”在'System.Windows.Markup.StaticExtension'上提供值引發異常“
我認為你的問題在於這一行:
Title="{x:Static res:Strings.WizardWelcomeWindow_Title}"
這是使用StaticExtension
地方。
通過轉到其屬性並檢查自定義工具是否設置為PublicResXFileCodeGenerator
(而不是ResXFileCodeGenerator
,這是默認設置),確保您的Strings.resx
是公共的 - 您可以直接在那里編輯它,也可以通過設計者中的Access Modified
組合框進行編輯當您打開資源文件時。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.