This documentation is archived and is not being maintained.

ContextNodeBaseCollection Class

Contains a collection of ContextNodeBase objects that are the result of an ink analysis.

Namespace:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

'Declaration
Public Class ContextNodeBaseCollection _
	Implements ICollection, IEnumerable
'Usage
Dim instance As ContextNodeBaseCollection

The following example shows how to loop through a ContextNodeBaseCollection from the InkAnalyzerBase. FindNodesOfType method of an InkAnalyzerBase named theInkAnalyzerBase. The example loops through all of the line nodes and, if two ink word nodes exist with the same word, it marks them as red.

' If two identical ink words occur next to each other, mark them as red. 
' Note: This doesn't actually look for pairs that go across two lines. 
Dim lines As ContextNodeBaseCollection = _
    theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line)

For Each lineNode As ContextNodeBase In lines

    Dim previousWord As ContextNodeBase = Nothing 
    Dim previousWordRecognizedString As String = "" 

    For Each inkWord As ContextNodeBase In _
        theInkAnalyzerBase.FindNodesOfType(ContextNodeTypeBase.InkWord, lineNode)

        Dim inkWordRecognizedString As String = "" 

        If inkWord.ContainsPropertyData(PropertyGuidsForContextNodesBase.RecognizedString) Then
            inkWordRecognizedString = _
                CType(inkWord.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), String)
        End If 

        ' TODO: I think I can get rid of this and just assign the previous string  
        ' to the current string 
        If Not previousWord Is Nothing Then

            previousWordRecognizedString = _
            CType(previousWord.GetPropertyData(PropertyGuidsForContextNodesBase.RecognizedString), String)

        End If 

        If previousWordRecognizedString <> "" Then 

            Dim previousWordStrokes As Strokes = theInk.CreateStrokes(previousWord.GetStrokeIds())
            Dim inkWordStrokes As Strokes = theInk.CreateStrokes(previousWord.GetStrokeIds())

            For Each aStroke As Stroke In previousWordStrokes
                aStroke.DrawingAttributes = New DrawingAttributes(Color.Red)
            Next aStroke

            For Each aStroke As Stroke In inkWordStrokes
                aStroke.DrawingAttributes = New DrawingAttributes(Color.Red)
            Next aStroke
        End If

        previousWord = inkWord

    Next inkWord
Next lineNode

System.Object
  System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection

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 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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: