Viewport 3D WPF C#(视口 3D WPF C#)
问题描述
能否请您展示如何设置和保存 viewport3D 的背景颜色.每当我保存没有背景是唯一可见的模型时,我尝试了网格,但是网格中的所有内容?有什么帮助吗?
Can you please show how to set and save the background color of the viewport3D. Whenever I save no background is visible only model, I tried the grid but that gets everything in the grid? Any help will do?
推荐答案
Viewport3D 没有 Background 属性,因此您需要在它后面添加一些东西.
Viewport3D doesn't have a Background property so you need something behind it.
您使用 Grid 的方法是正确的,您可能希望使用 Border 来执行使用一个孩子.
your approach using a Grid is right, you might want to use a Border to enforce the use of a single child.
<Border Background="Green">
<Viewport3D Width="640.0" Height="480.0" >
<ModelVisual3D/>
</Viewport3D>
</Border>
我假设您正在使用 XamlWriter, XamlReader .只需保存边框而不是 Viewport3D,边框内的所有内容也会被保存.
I assume you are using XamlWriter, XamlReader . Just save the border instead of the Viewport3D and everything inside the border will be saved as well.
这篇关于视口 3D WPF C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:视口 3D WPF C#


- WebMatrix WebSecurity PasswordSalt 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 输入按键事件处理程序 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04