リソース内の文字列をXAMLに表示する
Resources.resx
アクセス修飾子をPublicにし、文字列を格納する。

MainWindow.xaml
<Window x:Class="WpfApp27.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp27"
xmlns:prop="clr-namespace:WpfApp27.Properties"
mc:Ignorable="d"
Title="MainWindow" Height="150" Width="300">
<StackPanel>
<TextBlock Text="{x:Static prop:Resources.SampleText1}"/>
<TextBlock Text="{x:Static prop:Resources.SampleText2}"/>
</StackPanel>
</Window>
ディスカッション
コメント一覧
まだ、コメントがありません