TagVisualizer Class

Defines a content control that automatically displays visualization objects when a tag is placed on the control.

Namespace: Microsoft.Surface.Presentation.Controls
Assembly: Microsoft.Surface.Presentation (in Microsoft.Surface.Presentation)


[TemplatePartAttribute(Name="PART_TagVisualizationHost", Type=typeof(FrameworkElement))] 
public class TagVisualizer : ContentControl
/** @attribute TemplatePartAttribute(Name="PART_TagVisualizationHost", Type=System.Windows.FrameworkElement) */ 
public class TagVisualizer extends ContentControl
TemplatePartAttribute(Name="PART_TagVisualizationHost", Type=System.Windows.FrameworkElement) 
public class TagVisualizer extends ContentControl

The Definitions property of a TagVisualizer can be populated in code, or in XAML markup as the following example illustrates. This example comes from the Window1.xaml file in the Shopping Cart SDK sample. In this sample, the user interface content defined in the CardValidationPanel.xaml file is displayed when a tag with the value 0xC0 is placed on the screen. The root element of the CardValidationPanel.xaml file is a TagVisualization control.

<s:TagVisualizer VisualizationAdded="OnVisualizationAdded" Grid.RowSpan="1">
    <s:TagVisualizationDefinition Source="CardValidationPanel.xaml" 
                                      Value="0xC0" />
  <local:DragDropScatterView x:Name="ScatterLayer" Background="Transparent" ItemContainerStyle="{StaticResource ScatterItemStyle}" />

Other SDK samples that use the TagVisualizer control include Item Compare, Controls Box, and Tag Visualizer Events. For information about installing the SDK samples, see Sample Applications.

The TagVisualizer control reacts to one or more tagged physical objects that are placed on the Microsoft Surface screen by creating and displaying TagVisualization objects. A TagVisualization object represents the actual user interface that users see when they place the tagged physical object on the screen. The TagVisualizer control automatically tracks the motion of a tagged object and moves the TagVisualization object (in other words, the user interface) with the physical object.

The Definitions property of a TagVisualizer control is a collection of TagVisualizationDefinition objects that define which tagged physical objects should trigger the creation of a TagVisualization object. Other details about the display of a visualization are also part of a TagVisualizationDefinition object.

For more information about how TagVisualizer, TagVisualization, and TagVisualizationDefinition work together to produce visible reactions to tagged physical objects, see TagVisualizationDefinition.

For information about events that are related to adding and removing tagged physical objects, see TagVisualization. For a simple example, see Creating and Displaying Tag Visualizations.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.



Operating System (OS)Windows 7
Software Developer Kit (SDK)Surface 2.0
.NET Framework 4
Developer environmentVisual Studio 2010, Express or full edition
Microsoft Expression Blend 4.0 (optional)
End-user hardwareDevices made for Surface 2.0, or
Windows Touch computers

Did you find this information useful? Please send us your suggestions and comments.

© Microsoft Corporation. All rights reserved.