0

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.

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.