Wrapping with Dependency Properties
I've got a Windows Forms control that I'm wrapping with a WindowsFormsHost
-derived class to access WPF's data binding functionality. The Forms control exposes properties that indicate its state, along with the standard property-changed event notifier.
For example, a Zoom
property on the Forms control is accompanied with a ZoomChanged
event. In the WindowsFormsHo开发者_StackOverflow社区st
wrapper, I'm using a DependencyProperty
to represent the underlying Windows Forms control property. Binding works as expected going to the control using a PropertyMetaData
assignment callback; however, I'm not sure how to correctly propagate property changes from the wrapped control back out to binding subscribers (i.e., the Windows Form control changes its Zoom
property and raises the ZoomChanged
event). Any ideas on how to accomplish this? Should I be using a different approach?
Defaulted the Zoom dependency property to use two-way binding and everything works. D'oh!
精彩评论