我想一些属性从我绑定代码隐藏.xaml.cs一些XAML代码,就像这样:WPF绑定问题 - 不起作用?
<TextBlock [someProperties] ... Text="{Binding ElementName=awesome, Path=value}" />
<TextBlock [someProperties] ... Text="{Binding Path=legendary}" />
在相关.xaml.cs文件我也有属性:
public String legendary = "High five";
public CoolObject awesome = new CoolObject(); //has a public property "String value = '5';"
但我的TextBlocks只是不想显示该死的“高五”和“5”。我错过了什么?
感谢,设置在DataContext加上设置属性属性,而不是字段,做到了。好极了! – Thomas 2010-01-29 14:35:14
不客气 – Yurec 2010-01-29 15:01:34