Normally wpf objects inherits their parent's data context, so if you set a binding and theres no data context set, the binding engine it will automatically look for it in the parents. How can I make a custom class(that is not an UI element) to produce the same behavior when set as the child of another element?
views:
28answers:
1Freezable doesn't include a DataContext... Not sure how this is supposed to help here. DataContext is a defined on FrameworkElement.
Reed Copsey
2010-05-14 18:54:11
Can't I implement this behavior myself? I don't want to subclass from freezable just to do that...
Thiado de Arruda
2010-05-14 19:06:28
I don't think you can... you must at least inherit DependencyObject, since only dependency properties are bindable
Thomas Levesque
2010-05-14 19:43:41
@Reed : it doesn't need a DataContext. The binding will use on the parent's DataContext
Thomas Levesque
2010-05-14 20:22:17