This documentation is archived and is not being maintained.

ContextNodeType Class

Defines values that specify the type of ContextNode object.

Namespace: System.Windows.Ink
Assembly: IAWinFX (in iawinfx.dll)
XML Namespace:

public sealed class ContextNodeType
public final class ContextNodeType
public final class ContextNodeType
Not applicable.

The ContextNode.Type property and the InkAnalyzer.FindNodesOfType method frequently use the fields in System.Windows.Ink.ContextNodeType.

This example sets the Text property of a TextBox, selectedResultsTextBox, to show an appropriate string for a ContextNode, selectedNode. It uses the Type property to choose the kind of text to show, depending on the type of the ContextNode.

if (selectedNode.Type == ContextNodeType.WritingRegion)
    WritingRegionNode writingRegion = (WritingRegionNode)selectedNode;
    selectedResultsTextBox.Text = writingRegion.GetRecognizedString();
else if (selectedNode.Type == ContextNodeType.Paragraph)
    ParagraphNode paragraph = (ParagraphNode)selectedNode;
    selectedResultsTextBox.Text = paragraph.GetRecognizedString();
else if (selectedNode.Type == ContextNodeType.Line)
    LineNode line = (LineNode)selectedNode;
    selectedResultsTextBox.Text = line.GetRecognizedString();
else if (selectedNode.Type == ContextNodeType.InkWord)
    InkWordNode inkWord = (InkWordNode)selectedNode;
    ContextNode parentNode = inkWord.ParentNode;
    if (parentNode is LineNode)
        LineNode parentLine = (LineNode)parentNode;
        // Put parent line's recognized string into the text box
        selectedResultsTextBox.Text = parentLine.GetRecognizedString();

        // Select the text that corresponds to the ink word
        ContextNodeCollection subNodes = new ContextNodeCollection(theInkAnalyzer);
        int start;
        int length;
        parentLine.GetTextRangeFromNodes(subNodes, out start, out length);
        if (start >= 0 && length > 0)
            selectedResultsTextBox.Select(start, length);
else if (selectedNode.Type == ContextNodeType.InkDrawing)
    InkDrawingNode drawingNode = (InkDrawingNode)selectedNode;
    selectedResultsTextBox.Text = drawingNode.GetShapeName();
else if (selectedNode.Type == ContextNodeType.InkBullet)
    InkBulletNode bulletNode = (InkBulletNode)selectedNode;
    selectedResultsTextBox.Text = bulletNode.GetRecognizedString();
else if (selectedNode.Type == ContextNodeType.CustomRecognizer)
    CustomRecognizerNode customRecognizer = (CustomRecognizerNode)selectedNode;
    selectedResultsTextBox.Text = customRecognizer.GetRecognizedString();
else if (selectedNode.Type == ContextNodeType.Object)
    ObjectNode selectedObject = (ObjectNode)selectedNode;
    selectedResultsTextBox.Text = selectedObject.GetRecognizedString();
    selectedResultsTextBox.Text = "";


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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0