Yves,
Thank you for the reply.
The "this" is one of mt UserControsl.
1) Using "this" I have to adjust the x, y for title bar (about 18 pixels and 8 for vertical border) and it seems ALMOST right.
2) I tried e.GetPosition(this.myViewport) and the location is still clearly off... I thought this will work precisely.
3) How do I get the position of client area of my UserControl?
<
UserControl
x:Class="ns_Main.Controls.CView"
PreviewMouseLeftButtonDown="UserControl_PreviewMouseLeftButtonDown"
PreviewMouseLeftButtonUp="UserControl_PreviewMouseLeftButtonUp"
PreviewMouseRightButtonDown="UserControl_PreviewMouseRightButtonDown"
PreviewMouseRightButtonUp="UserControl_PreviewMouseRightButtonUp"
PreviewMouseDoubleClick="UserControl_PreviewMouseDoubleClick"
PreviewMouseMove="UserControl_PreviewMouseMove"
SizeChanged="UserControl_SizeChanged">
<Grid
Background="LightGreen">
<!--
Place a Label control at the top of the view. -->
<Label
HorizontalAlignment="Center"
TextBlock.TextAlignment="Center"
FontSize="20"
Foreground="Green"
Content="CView Model: Yellow
Cone"/>
<!--
Viewport3D is the rendering surface. -->
<Viewport3D
Name="myViewport"
<!--
Add a camera under Viewport3D.Camera -->
<Viewport3D.Camera>
<PerspectiveCamera
x:Name="myCamera"
Position="0,0,-4"
LookDirection="0,0,1"
UpDirection="1,0,0"
FieldOfView="15"
NearPlaneDistance="1"
FarPlaneDistance="20" />
</Viewport3D.Camera>
<!--
Add models under Viewport3D.Children -->
<Viewport3D.Children>