wpfwinformsbindingelementhost

Binding a WPF element host to a WinForm property


I have a WPF element host sitting in a WinForm.

I would like to bind a property of the element to a property of the WinForm.

In my searches I found the opposite solution, binding between WinForms to WPF properties (when the WinForm is sitting on a WPF host).

Here is an example: How to bind a windows control in WPF????

I also saw this answer (not exactly an answer, I'd say a conclusion): Binding to a WPF hosted control's DependencyProperty in WinForms

It did not help me. I also want to keep the the principle of MVVM in the WPF element host.

|It there a way to do this?


Solution

  • Finally I solved it this way:

    I created a property in ViewModel and init him through the WinForm when I use the wpf host control in the first time.

    I binding the property to element in xaml

    and that's all.