I have this Text
dependency property in code behind:
public static DependencyProperty TextProperty =
DependencyProperty.Register("Text", typeof(string), typeof(MainWindow),
new PropertyMetadata("Hello world"));
public string Text {
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
I want to bind content of label to that Text
property so that the label displays actual value of Text
property and vice-versa.
<Label Content="{Binding ???}" />
How can I do it ?
I have done that some time before but now I cannot remember how - and it is very simple. The simplest code will be accepted.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…