This documentation is archived and is not being maintained.

ContextNode.Type Property

Gets the context node type for this ContextNode object.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

public Guid Type { get; }

Property Value

Type: System.Guid
The context node type for this ContextNode object.

See the ContextNodeType class for the type GUID values.

The following example shows how to use the Type property of a ContextNode object, selectedNode. The text of a TextBox, selectedResultsTextBox, is filled differently depending on the type of node. In most cases, the recognized string is used, but for InkWord, the line's recognized string is used, and the word is selected in the TextBox.

				if (selectedNode.Type == Microsoft.Ink.ContextNodeType.WritingRegion)
                {
					WritingRegionNode writingRegion = (WritingRegionNode)selectedNode;
					selectedResultsTextBox.Text = writingRegion.GetRecognizedString();
                }
				else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.Paragraph)
                {
					ParagraphNode paragraph = (ParagraphNode)selectedNode;
					selectedResultsTextBox.Text = paragraph.GetRecognizedString();
                }
				else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.Line)
                {
					LineNode line = (LineNode)selectedNode;
					selectedResultsTextBox.Text = line.GetRecognizedString();
                }
				else if (selectedNode.Type == Microsoft.Ink.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);
                        subNodes.Add(inkWord);
                        int start = 0;
                        int length = 0;
                        parentLine.GetTextRangeFromNodes(subNodes, out start, out length);
						if (start >= 0 && length > 0)
						{
							selectedResultsTextBox.Select(start, length);
						}
					}
                }
				else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.InkDrawing)
                {
					InkDrawingNode drawingNode = (InkDrawingNode)selectedNode;
					selectedResultsTextBox.Text = drawingNode.GetShapeName();
                }
            	else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.InkBullet)
                {
					InkBulletNode bulletNode = (InkBulletNode)selectedNode;
                    selectedResultsTextBox.Text = bulletNode.GetRecognizedString();
                }
                else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.CustomRecognizer)
                {
                    CustomRecognizerNode customRecognizer = (CustomRecognizerNode)selectedNode;
                    selectedResultsTextBox.Text = customRecognizer.GetRecognizedString();
                }
                else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.Object)
                {
                    ObjectNode selectedObject = (ObjectNode)selectedNode;
                    selectedResultsTextBox.Text = selectedObject.GetRecognizedString();
                }
                else
                {
					selectedResultsTextBox.Text = String.Empty;
				}

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.0
Show: