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

绑定 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="http://www.mamicode.com/10"/>
<Setter Property="FontSize" Value="http://www.mamicode.com/150"/>
<Setter Property="Foreground" Value="http://www.mamicode.com/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>

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