i have a textbox in a UserControl,
i created a property in the UserControl,
i want to bind the textbox text property to the property created in the usercontrol.
The problem is that i dont know how to especify the datacontext to the current class in XAML.
Any idea?? thanks
This will get what you enter in your textbox to your property in the codebehind. Depending on the size of your project I’d consider MVVM to push the code out to the ViewModel, then in the UserControl you’d specify this.DataContext = an instance of your ViewModel.
Xaml:
Code Behind: