C# 如何在不单击WPF按钮的情况下更新线框?

C# 如何在不单击WPF按钮的情况下更新线框?,c#,wpf,winforms,3d,helix-3d-toolkit,C#,Wpf,Winforms,3d,Helix 3d Toolkit,我正在开发一个Windows窗体应用程序,在WF中嵌入WPF用户控件。如果我添加一个按钮并执行我的userControl.DrawWireFrameCube()我的视口3D得到更新。我正在使用Helix 3D工具包。但是,如果我从MainWindowForm类调用我的方法,它不会被执行,UI也不会被更新,而只是userControl.DrawWireFrameCube()不起作用。另一个userControl.Draw3DObject(插入点、点、颜色)方法工作正常 private void

我正在开发一个Windows窗体应用程序,在WF中嵌入WPF用户控件。如果我添加一个按钮并执行我的
userControl.DrawWireFrameCube()我的视口3D得到更新。我正在使用Helix 3D工具包。但是,如果我从MainWindowForm类调用我的方法,它不会被执行,UI也不会被更新,而只是
userControl.DrawWireFrameCube()不起作用。另一个
userControl.Draw3DObject(插入点、点、颜色)方法工作正常

 private void VisualizePart(int index)
        {
            InsertionPoint insertionPoint = new InsertionPoint
            {
                X = _duplicatedListParts[index].INFO1,
                Y = _duplicatedListParts[index].INFO2,
                Z = _duplicatedListParts[index].INFO3
            };

            DetailSize points = new DetailSize
            {
                Length = _duplicatedListParts[index].LENGTH,
                Width = _duplicatedListParts[index].WIDTH,
                Thickness = _duplicatedListParts[index].THICKNESS
            };
            userControl.Dispatcher.Invoke(() =>
            {
                System.Windows.Media.Color color = System.Windows.Media.Color.FromRgb(255, 90, 0);
                userControl.Draw3DObject(insertionPoint, points, color);
                userControl.DrawWireFrameCube();
            });
        }
不同之处在于,在我的
Draw3DObject()
中,我向
Model3DGroup
添加了项目,在
DrawWireFrameCube()
中,我向
MyViewPort3D
添加了项目。我没有使用XAML,我希望保持这种方式。 你知道这里怎么了吗

附言:我喜欢不加解释的反对票:)