以前、単純な文字列リソースに静的クラスを使用した WinForms アプリケーションがありました。このクラスには、アクセスできる定数文字列がありました。これらの文字列の 1 つは、別の定数の値と独自の値で構成されていました。このようなもの:
private const string Path = @"C:\SomeFolder\";
public const string FileOne = Path + "FileOne.txt";
public const string FileTwo = Path + "FileTwo.txt";
現在、WPF アプリケーションがあり、Application スコープにマージした ResourceDictionary を使用しています。すべて正常に動作しますが、上記の C# コードのようなものが必要です。これは私がすでに持っているものです:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib">
<System:String x:Key="Path">C:\SomeFolder\</System:String>
<System:String x:Key="FileOne">FileOne.txt</System:String>
<System:String x:Key="FileTwo">FileTwo.txt</System:String>
</ResourceDictionary>
ここで、2 つのファイル文字列に自動的に追加される何か (「パス」への何らかの参照) が必要です。C# コードのようにプライベートである必要はありません。どうすればこれを達成できるか知っている人はいますか?
前もって感謝します!