3

i have viewport3d and i want to change its background color.

i am very new to Wpf. i didnt understand what to do from other posts. so i ask here.

i changed brush property for viewport3d but it does nothing

<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>

M.kazem Akhgary
  • 18,645
  • 8
  • 57
  • 118

1 Answers1

7

Viewport3D is a control that creates a 3D scene for you to render things into. 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.

Xavier
  • 3,254
  • 15
  • 22