1
我已將WindowsMediaPlayer ActiveX添加到我的WPF/MVVM應用程序中。現在我需要控制對視圖模型中發生的變化作出反應(最重要的是當集合中的當前選擇更改時更新URL)。基於Walkthrough: Hosting an ActiveX Control in WPF我已經在我的Loaded事件如下:如何將ActiveX控件掛入事件/更改到我的viewmodel中?
// Create the interop host control.
System.Windows.Forms.Integration.WindowsFormsHost host =
new System.Windows.Forms.Integration.WindowsFormsHost();
// Create the ActiveX control.
AxWMPLib.AxWindowsMediaPlayer axWmp = new AxWMPLib.AxWindowsMediaPlayer();
// Assign the ActiveX control as the host control's child.
host.Child = axWmp;
// Add the interop host control to the Grid
// control's collection of child controls.
this.pnlMediaPlayer.Children.Add(host);
的問題是 - 我怎麼在我的視圖模型屬性更改更新axWMP.URL控制的財產?
這個工作很大的更新從視圖模型的ActiveX控件,但你有沒有從ActiveX控件更新視圖模型如果又如何? – Zamboni 2011-11-12 17:45:18