Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to implement two way binding between an ActiveX control and a WPF MVVM View Model
    text
    copied!<p>I have a WPF application implemented using the MVVM framework that uses an ActiveX control and I need to keep the WPF and ActiveX UI synchronised.</p> <p>So far I can update the ActiveX UI when I change the WPF UI using the code at the bottom of the question that I got from the article <a href="http://msdn.microsoft.com/en-us/library/ms742735.aspx" rel="nofollow noreferrer">Hosting an ActiveX Control in WPF</a> and this <a href="https://stackoverflow.com/q/3895356/174682">question</a>.</p> <p>But I cannot update the WPF UI when I make a change in the ActiveX UI.</p> <p>I suspect that I need to fire the PropertyChanged event from my ActiveX control but I have no idea how to do this or if it is even possible.</p> <p>The ActiveX controls I have written are in VB6 and MFC as I am just prototying at this time for the eventual integration of VB6 ActiveX controls in a WPF contaner application.</p> <p>Here is a code snipet that indicates the work done so far:</p> <pre><code>System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); // Create the ActiveX control. AxTEXTBOXActiveXLib.AxTEXTBOXActiveX axWmp = new AxTEXTBOXActiveXLib.AxTEXTBOXActiveX(); // Assign the ActiveX control as the host control's child. host.Child = axWmp; axWmp.DataBindings.Add(new System.Windows.Forms.Binding("ActiveXStatus", (MainWindowViewModel)this.DataContext, "ModelStatus", true, DataSourceUpdateMode.OnPropertyChanged )); // Add the interop host control to the Grid // control's collection of child controls. this.activexRow.Children.Add(host); </code></pre> <p>How to implement two way binding between an ActiveX control and a WPF MVVM View Model?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload