title: wpf create 3d cube and rotate it along x, y and z axis
body: <p>I have the following code:</p>
  
  <pre><code>&lt;Window x:Class="Demo3D.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" Height="350" Width="525"&gt;
      &lt;Grid&gt;
          &lt;Viewport3D Name="viewport3D1"&gt;
              &lt;Viewport3D.Camera&gt;
                  &lt;PerspectiveCamera x:Name="camMain" Position="6 5 4" LookDirection="-6 -5 -4"&gt;
                  &lt;/PerspectiveCamera&gt;
              &lt;/Viewport3D.Camera&gt;
              &lt;ModelVisual3D&gt;
                  &lt;ModelVisual3D.Content&gt;
                      &lt;DirectionalLight x:Name="dirLightMain" Direction="-1,-1,-1"&gt;
                      &lt;/DirectionalLight&gt;
                  &lt;/ModelVisual3D.Content&gt;
              &lt;/ModelVisual3D&gt;
              &lt;ModelVisual3D x:Name="MyModel"&gt;
                  &lt;ModelVisual3D.Content&gt;
                      &lt;GeometryModel3D&gt;
                          &lt;GeometryModel3D.Geometry&gt;
                              &lt;MeshGeometry3D x:Name="meshMain"
                                  Positions="0 0 0  1 0 0  0 1 0  1 1 0  0 0 1  1 0 1  0 1 1  1 1 1"
                                  TriangleIndices="2 3 1  2 1 0  7 1 3  7 5 1  6 5 7  6 4 5  6 2 0  2 0 4  2 7 3  2 6 7  0 1 5  0 5 4"&gt;
                              &lt;/MeshGeometry3D&gt;
                          &lt;/GeometryModel3D.Geometry&gt;
                          &lt;GeometryModel3D.Material&gt;
                              &lt;DiffuseMaterial x:Name="matDiffuseMain"&gt;
                                  &lt;DiffuseMaterial.Brush&gt;
                                      &lt;SolidColorBrush Color="Red"/&gt;
                                  &lt;/DiffuseMaterial.Brush&gt;
                              &lt;/DiffuseMaterial&gt;
                          &lt;/GeometryModel3D.Material&gt;
                      &lt;/GeometryModel3D&gt;
                  &lt;/ModelVisual3D.Content&gt;
                  &lt;ModelVisual3D.Transform&gt;
                      &lt;RotateTransform3D&gt;
                          &lt;RotateTransform3D.Rotation&gt;
                              &lt;AxisAngleRotation3D x:Name="rotate" Axis="1 0 0"/&gt;
                          &lt;/RotateTransform3D.Rotation&gt;
                      &lt;/RotateTransform3D&gt;
                  &lt;/ModelVisual3D.Transform&gt;
              &lt;/ModelVisual3D&gt;
          &lt;/Viewport3D&gt;
          &lt;Slider Height="23" HorizontalAlignment="Left" 
                  Margin="12,12,0,0" Name="slider1"
                  VerticalAlignment="Top" Width="187" 
                  Maximum="360"
                  Value="{Binding ElementName=rotate, Path=Angle}" /&gt;
  
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>I am able to rotate the cube by sliding the slider. The problem is that the cube does not rotate around it's center. How can I make that cube rotate around it's center? In other words it will be nice if I could do something like <a href="http://www.youtube.com/watch?feature=player_embedded&amp;v=a7mTytwRGqI" rel="nofollow">http://www.youtube.com/watch?feature=player_embedded&amp;v=a7mTytwRGqI</a></p>