Controls.ItemsControl
(実際には a )がHelixViewport3D
あり、 a 内に追加したいと思いForms.UserControl
ます。
this.Controls.Add(new HelixViewport3D());
私はすでにWhere this is a派生物 を試しましたが、これはUserControl
エラーになりましたHelixToolkit.Wpf.HelixViewport3D' to 'System.Windows.Forms.Control
。互いに何も継承していないことを考えると、これは理にかなっています。これらの状況で一種のラッパー クラスはありますか?
using HelixToolkit.Wpf;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
public partial class HelixForm : Form
{
public HelixForm()
{
InitializeComponent();
var _3Dcntr = new HelixViewport3D();
this.Controls.Add(_3Dcntr);//doesn't work
//what we worked out so far
var elemHost = new ElementHost();
}
}
また、ElementHost.Child を使用して winform で WPF をホストできるはずであることに気付きましたが、この変数/関数を追加すると、私のコード例では見つかりません (何か不足していますか?)、 System.Windows.Forms.Integration.ElementHost は伝えます私 System.Windows.Forms.Integration がありません。