<Window x:Class="TransformExamples.Translate"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="TranslateTransform3D" Height="300" Width="300"
    >
  <Viewbox Grid.Row="1" ClipToBounds="True">
    <Border BorderBrush="Black" BorderThickness="1" Margin="2">

      <Viewport3D ClipToBounds="True" Width="300" Height="200">
        <Viewport3D.Camera>
          <PerspectiveCamera Position="0,0,4" LookDirection="0,0,-1"
                   UpDirection="0,1,0" FieldOfView="45" />
        </Viewport3D.Camera>
        <Viewport3D.Resources>
          <ResourceDictionary>
          </ResourceDictionary>
        </Viewport3D.Resources>

        <ModelVisual3D>
          <ModelVisual3D.Content>
            <Model3DGroup>
              <AmbientLight Color="#333333" />
              <DirectionalLight Color="#FFFFFF" Direction="0.0156948,-0.897322,-0.4410982" />
              <DirectionalLight Color="#FFFFFF" Direction="0.795738,0.0155303,-0.605442" />
            </Model3DGroup>
          </ModelVisual3D.Content>


          <!-- Example 17-20. Positioning models with TranslateTransform3D -->
          
          <ModelVisual3D Content="{StaticResource cylinderModel}">
            <ModelVisual3D.Transform>
              <TranslateTransform3D OffsetX="-1" OffsetZ="0" />
            </ModelVisual3D.Transform>
          </ModelVisual3D>
          <ModelVisual3D Content="{StaticResource cylinderModel}">
            <ModelVisual3D.Transform>
              <TranslateTransform3D OffsetX="-0.5" OffsetZ="-0.5" />
            </ModelVisual3D.Transform>
          </ModelVisual3D>
          <ModelVisual3D Content="{StaticResource cylinderModel}">
            <ModelVisual3D.Transform>
              <TranslateTransform3D OffsetX="0" OffsetZ="-1" />
            </ModelVisual3D.Transform>
          </ModelVisual3D>
          <ModelVisual3D Content="{StaticResource cylinderModel}">
            <ModelVisual3D.Transform>
              <TranslateTransform3D OffsetX="0.5" OffsetZ="-1.5" />
            </ModelVisual3D.Transform>
          </ModelVisual3D>
          <ModelVisual3D Content="{StaticResource cylinderModel}">
            <ModelVisual3D.Transform>
              <TranslateTransform3D OffsetX="1" OffsetZ="-2" />
            </ModelVisual3D.Transform>
          </ModelVisual3D>

          <!-- End of Example 17-20. -->

        </ModelVisual3D>
      </Viewport3D>

    </Border>
  </Viewbox>
</Window>