视口 3D WPF C#

Viewport 3D WPF C#(视口 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#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)