我想一些屬性從我綁定代碼隱藏.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