简体   繁体   English

如何在WPF中更改ViewPort3D背景颜色?

[英]How to change ViewPort3D background color in WPF?

i have viewport3d and i want to change its background color. 我有viewport3d,我想更改其背景色。

i am very new to Wpf. 我对Wpf很陌生。 i didnt understand what to do from other posts. 我不明白从其他职位该怎么办。 so i ask here. 所以我在这里问。

i changed brush property for viewport3d but it does nothing 我更改了viewport3d的brush属性,但没有任何作用

<Window x:Class="W3DTinker.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="800" Width="1200">
<Grid HorizontalAlignment="Left" Height="780" Margin="10,10,0,-21" VerticalAlignment="Top" Width="1180">
    <Viewport3D Grid.Row="0" Grid.Column="0" x:Name="Viewport" Margin="350,10,10,10" OpacityMask="{DynamicResource {x:Static SystemColors.AppWorkspaceBrushKey}}" />
</Grid>

Viewport3D is a control that creates a 3D scene for you to render things into. Viewport3D是一个控件,可为您创建3D场景以将事物渲染到其中。 It does not display anything by itself. 它本身不显示任何内容。 If you want a background color behind it, then set the background color on its parent control, which in your case is the Grid that contains it. 如果要在其后面添加背景色,请在其父控件上设置背景色,在您的示例中是包含它的Grid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM