I am working on Viewport2DVisual3D .I want to display the grid table with contents like button , image etc.User wants to click on the button in the gird to fire some events.Now User are able to view the grid and rotate it with ScrollBar .But when the user mouse over the grid it shows the error like .This freezable cannot be frozen, I am not able to find out the reason in my code .Please help me. My XAML code is below:
What I have tried:
<Page x:Class="Viewport2DVisual3D.Page4"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Title="Page4">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<ScrollBar Name="vscroll"
Grid.Row="0" Grid.Column="1"
Orientation="Vertical"
Minimum="0" Maximum="360"
LargeChange="10" SmallChange="1" Value="200" />
<ScrollBar Name="hscroll"
Grid.Row="1" Grid.Column="0"
Orientation="Horizontal"
Minimum="0" Maximum="360"
LargeChange="10" SmallChange="1" Value="0" />
<Viewport3D Margin="4,4,4,4" Grid.Row="0" Grid.Column="0">
<Viewport3D.Camera>
<PerspectiveCamera
Position = "1.5, 2, 3"
LookDirection = "-1.5, -2, -3"
UpDirection = "0, 1, 0"
FieldOfView = "60">
<PerspectiveCamera.Transform>
<Transform3DGroup>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D
Axis="0 1 0"
Angle="{Binding ElementName=hscroll, Path=Value}" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D
Axis="1 0 0"
Angle="{Binding ElementName=vscroll, Path=Value}" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
</Transform3DGroup>
</PerspectiveCamera.Transform>
</PerspectiveCamera>
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<DirectionalLight Color="White" Direction="0,0,3"/>
</ModelVisual3D.Content>
</ModelVisual3D>
<Viewport2DVisual3D >
<Viewport2DVisual3D.Geometry>
<MeshGeometry3D TriangleIndices="0,1,2 2,3,0 4,5,6 6,7,4 8,9,10 10,11,8 12,13,14 14,15,12 16,17,18 18,19,16 20,21,22 22,23,20"
Positions="-0.755,-1,-0.03125 -0.755,1,-0.03125 0.755,1,-0.03125 0.755,-1,-0.03125 -0.755,-1,-0.0001 0.755,-1,-0.0001 0.755,1,-0.0001 -0.755,1,-0.0001 -0.755,-1,-0.03125 0.755,-1,-0.03125 0.755,-1,-0.0001 -0.755,-1,-0.0001 0.755,-1,-0.03125 0.755,1,-0.03125 0.755,1,0 0.755,-1,0 0.755,1,-0.03125 -0.755,1,-0.03125 -0.755,1,-0.0001 0.755,1,-0.0001 -0.755,1,-0.03125 -0.755,-1,-0.03125 -0.755,-1,-0.0001 -0.755,1,-0.0001"
TextureCoordinates="1,1 1,0 0,0 0,1 0,0 0,0 0,0 1,0 0,0 0,0 1,1 0,0 1,0 1,1 0,1 0,1 0,0 0,1 0,0 1,0 0,1 1,1 1,0 0,0" />
</Viewport2DVisual3D.Geometry>
<Viewport2DVisual3D.Material>
<DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True"/>
</Viewport2DVisual3D.Material>
<Viewport2DVisual3D.Visual >
<Grid Width="500" Height="500" Background="Wheat" Name="my_grid" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Column="0" Grid.Row ="0" Background="GreenYellow" >
</StackPanel>
<Button Grid.Column="0" Grid.Row ="1" Content="Button" Width="Auto" Height="Auto" Click="Button_Click" Padding="0" />
</Grid>
</Viewport2DVisual3D.Visual>
</Viewport2DVisual3D>
</Viewport3D>
</Grid>
</Page>