绑定 Binding Path=.,Binding.,Binding Source={StaticResource ResourceKey="Hello"} xmlns:sys="clr-namespace:System;assembly=mscorlib"

 xmlns:sys="clr-namespace:System;assembly=mscorlib"

<Window.Resources>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="10"/>
<Setter Property="FontSize" Value="150"/>
<Setter Property="Foreground" Value="Black"/>
</Style>
</Window.Resources>
<StackPanel x:Name="stackPanel">
<StackPanel.Resources>
<sys:String x:Key="Hello">
Nice to meet you!
</sys:String>
</StackPanel.Resources>
<TextBlock Text="{Binding Path=.,Source={StaticResource ResourceKey=Hello}}"/>
<TextBlock Text="{Binding .,Source={StaticResource ResourceKey=Hello}}"/>
<TextBlock Text="{Binding Source={StaticResource ResourceKey=Hello}}"/>
</StackPanel>

posted @ 2016-10-19 16:15  FredGrit  阅读(514)  评论(0编辑  收藏  举报