1

I have a list box which contains a usercontrol. And the user controls 2-3 text boxes defined in it.How do i enable data binding on those text boxes?

1 Answers1

0

You can simply create DependencyProperty-s for each of them, and you can directly bind through the xaml like so:

<user:MyControl txtBox1="{Binding Field1}" txtBox2="{Binding Field2}" ... />

To create a DependencyProperty, you can be as lazy as writing "propdp" + TAB. There are tons of articles, blog posts and general information available on the subject of DependencyPropertys, so have at it. A good place to start would be:

http://msdn.microsoft.com/en-us/library/ms752914.aspx

http://msdn.microsoft.com/en-us/library/system.windows.dependencyproperty.aspx

What is a dependency property?

Good luck! They're really fun to work with. :-)

Community
  • 1
  • 1
Kris Selbekk
  • 7,438
  • 7
  • 46
  • 73