外部ファイルを使用してアプリのスタイルをカスタマイズしたいのですが、うまくいきません。私はこのステップバイステップに従っていますが、プロジェクトの例外を実行すると、次のようになります。
System.Windows.ni.dll で、タイプ 'System.Windows.Markup.XamlParseException' の初回例外が発生しました
私のXAMLコード:
app.xaml:
<Application.Resources>
<local:LocalizedStrings xmlns:local="clr-namespace:App1" x:Key="LocalizedStrings"/>
<ResourceDictionary x:Key="myDict">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Resources.xaml:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="TextBox" x:Key="MyTextBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0.5"/>
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="Opacity" Value="0.5"/>
<Setter Property="Foreground" Value="Red"/>
</Style>
</ResourceDictionary>