Is it possible to set the DataContext property of a usercontrol after the user control has been loaded, and force the usercontrol to rebind?
+2
A:
I'm pretty sure that if you just set the datacontext again, it will rebind
Jacob Adams
2008-12-15 22:56:55
+2
A:
If you need to do extra work when the DataContext changes you can use a custom DependencyProperty and bind it to the DataContext property. Use the DependencyPropertyChangedEventHandler to know when the DP changed.
For a more complete explanation see my blog post at http://msmvps.com/blogs/theproblemsolver/archive/2008/12/29/how-to-know-when-the-datacontext-changed-in-your-control.aspx.
Maurice
2008-12-30 09:53:20