Visual3D.TransformToAncestor and Visual3D.TransformToDescendant
Visual3D
contains methods for the opposite scenario of mapping from 3D space into 2D space. The GeneralTransform3DTo2D
returned by Visual3D.TransformToAncestor
maps from the Visual3D
’s 3D coordinate space into some 2D parent’s coordinate space. This is especially useful when an app tracks a 3D point on the screen and then draws 2D content whose position must follow that 3D point.
Listings 8.10 and 8.11 use TransformToAncestor
to make the TextBlock
s to follow the corners of the rotating cube, as shown in Figure 8.53.
<Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ...
Get XAML Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.