开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜