0
我想將類的屬性綁定到標籤內容。如何與XAML綁定
public partial class MainWindow : Window
{
public MyClass singletonInst = MyClass.Instance;
//...
}
public class MyClass
{
public String MyValue
{
get { return "i'm the value"; }
}
//...
}
在我MainWindow.Xaml.cs我有我的窗口名稱= 「DefaultWindow」 和我的標籤我有..
<Label Content="{Binding ElementName=DefaultWindow, Path=singletonInst.MyValue}" ...
但它不工作。有什麼建議麼?
對於記錄如果我將MyValue屬性移動到MainWindow類並將標籤內容綁定路徑更改爲「MyValue」,那麼它的工作原理 – bep 2011-06-14 19:57:07