c# - 如何在没有 WPF 按钮单击的情况下更新线框?
问题描述
我正在开发一个 Windows 窗体应用程序,其中 WPF 用户控件嵌入在 WF 中。如果我添加一个按钮并执行我的userControl.DrawWireFrameCube();
My ViewPort3D 得到更新。我正在使用 Helix 3D 工具包。但是如果我从我的 MainWindowForm 类中调用我的方法,它不会被执行并且 UI 不会更新,但只是userControl.DrawWireFrameCube();
不起作用。另userControl.Draw3DObject(insertionPoint, points, color);
一种方法工作正常。
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,我想保持这种状态。任何想法这里有什么问题?
PS我喜欢没有解释的反对票:)
解决方案
推荐阅读
- python - 如何递归访问 JSON 中的 $ref 以完成整个 JSON?
- javascript - 我想组合 jQuery、AJAX 和 Flask,但我无法从服务器获得响应以在模板上写入
- php - PHP - ifless 按数字选择
- c++ - 私有对象的互斥锁 - 全局与属性
- python - 使用 Python 登录使用 OAuth 2.0 的网站
- c++ - std::iterator::reference 必须是参考吗?
- typescript - 在源文件夹之外引用 Typescript 项目
- firebase - Flutter Firebase实时数据库获取单条数据查询结果值null
- ruby - gem push 失败,控制台中的 HTML 输出
- c# - Discord bot C# 读取请求频道上的特定消息