I am very new to wpf as well as Dependency properties.How can we create a dependency property for a TextBox that sets the text property of the TextBox from any other class in the solution.
Asked
Active
Viewed 1,270 times
1 Answers
3
You don't need a DependencyProperty
for that.
DependencyProperties
are normally used when you create a Custom Control, which is not what you're doing here.
In your case, you need to use Data Binding, which is a feature of WPF that allows you to "link" or more precisely "bind" the Values of most properties of UI elements to values in some properties of some other classes. For example:
XAML:
<TextBox Text="{Binding LastName}"/>
Class:
public class Person
{
public string LastName {get;set;}
}
I suggest you read up on basic WPF concepts in WPFTutorial.net

Community
- 1
- 1

Federico Berasategui
- 43,562
- 11
- 100
- 154