WPF中C#创建Perspective Camera应用到Viewport3D无效问题
WPF中C#代码创建PerspectiveCamera无法渲染3D场景问题
我尝试使用C#创建新的PerspectiveCamera并将其应用到XAML中的Viewport3D组件,但直接在XAML中编写对应代码时可正常显示3D场景,使用C#实现相同逻辑却无法正常渲染,仅呈现空白屏幕。我采用了微软官方的3D场景创建示例代码,其中XAML版本运行正常,但C#版本依旧无效。
相关代码如下:
XAML版本代码
<Viewport3D Name="SceneViewViewport" Width="954" Height="659">...</Viewport3D>
C#初始化代码
viewport = (Viewport3D)FindName("SceneViewViewport"); SceneViewWidth = (float)viewport.Width; SceneViewHeight = (float)viewport.Height; Setup();
Setup方法代码
void Setup() {... }
内容的提问来源于stack exchange,提问作者kibrjr BC
相关产品推荐
相关产品推荐

