Sdílet prostřednictvím


InkWordNode.GetRecognizedString Method

Returns the best-result string of the recognition for the InkWordNode.

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

Syntax

'Declaration
Public Function GetRecognizedString As String
'Usage
Dim instance As InkWordNode 
Dim returnValue As String 

returnValue = instance.GetRecognizedString()
public string GetRecognizedString()
public:
String^ GetRecognizedString()
public function GetRecognizedString() : String

Return Value

Type: System.String
The best-result string of the recognition for the InkWordNode.

Examples

The following example is a method that recursively traverses a tree of ContextNode objects and populates a TreeView by adding TreeViewItem objects and setting their Header property to GetRecognizedString.

Private Shared Sub WalkTree(ByVal parentContextNode As ContextNode, ByVal parentTreeNode As TreeViewItem) 

    parentTreeNode.IsExpanded = True 

    For Each theContextSubnode As ContextNode In parentContextNode.SubNodes
        Dim newTreeNode As New TreeViewItem()
        newTreeNode.Header = theContextSubnode.ToString()

        If TypeOf theContextSubnode Is InkWordNode Then
            newTreeNode.Header += ": " + CType(theContextSubnode, InkWordNode).GetRecognizedString()
        ElseIf TypeOf theContextSubnode Is InkDrawingNode Then
            newTreeNode.Header += ": " + CType(theContextSubnode, InkDrawingNode).GetShapeName()
        End If 

        ' If the context node is confirmed, add a note to the 
        ' tree view item. 
        If (theContextSubnode.IsConfirmed(ConfirmationType.NodeTypeAndProperties)) Then

            newTreeNode.Header += " Confirmed." 
        End If 


        ' Add the context node as a tag of the tree view item and 
        ' add the new tree view item to the parent node.
        newTreeNode.Tag = theContextSubnode
        parentTreeNode.Items.Add(newTreeNode)

        WalkTree(theContextSubnode, newTreeNode)
    Next theContextSubnode

End Sub 'WalkTree
private static void WalkTree(ContextNode parentContextNode, TreeViewItem parentTreeNode)
{
    // Expand the current TreeViewItem.
    parentTreeNode.IsExpanded = true;

    foreach (ContextNode theContextSubnode
        in parentContextNode.SubNodes)
    {
        TreeViewItem newTreeNode = new TreeViewItem();
        newTreeNode.Header = theContextSubnode.ToString();

        if (theContextSubnode is InkWordNode)
        {
            newTreeNode.Header += ": " +
                ((InkWordNode)theContextSubnode).GetRecognizedString();
        }
        else if (theContextSubnode is InkDrawingNode)
        {
            newTreeNode.Header += ": " +
                ((InkDrawingNode)theContextSubnode).GetShapeName();
        }

        // If the context node is confirmed, add a note to the 
        // tree view item. 
        if (theContextSubnode.IsConfirmed(ConfirmationType.NodeTypeAndProperties))
        {
            newTreeNode.Header += " Confirmed.";
        }

        // Add the context node as a tag of the tree view item and 
        // add the new tree view item to the parent node.
        newTreeNode.Tag = theContextSubnode;
        parentTreeNode.Items.Add(newTreeNode);

        WalkTree(theContextSubnode, newTreeNode);
    }
}

Platforms

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.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkWordNode Class

InkWordNode Members

System.Windows.Ink Namespace

InkWordNode.SetRecognizedString