【发布时间】:2014-09-01 08:27:25
【问题描述】:
我有一个视图模型,我在其中以这种方式创建我的 windows 窗体:
System.Windows.Forms.DataVisualization.Charting.Chart chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
我的 XAML 是:
<WindowsFormsHost x:Name="host" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<wfCharts:Chart x:Name="MyWinformChart" >
<wfCharts:Chart.Series>
<wfCharts:Series Name="SerieGraficoExterior" />
</wfCharts:Chart.Series>
<wfCharts:Chart.ChartAreas>
<wfCharts:ChartArea/>
</wfCharts:Chart.ChartAreas>
</wfCharts:Chart>
</WindowsFormsHost>
但我不知道是否可以绑定到我的视图,因为WindowsFormsHost控件没有ContentControl之类的Content属性,所以我不知道是否可以在MVVM中使用WindowsFormsHost图案。我用 WPF 做了一些尝试,它在后面的代码中工作,但如果可能的话,我想使用 MVVM 模式。
谢谢。
【问题讨论】:
标签: c# wpf mvvm winforms-interop