Export (0) Print
Expand All
Expand Minimize

ConfirmationType Enumeration

Defines values that specify the type confirmation that can occur on a ContextNode object.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

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

[FlagsAttribute]
public enum ConfirmationType

Member nameDescription
NoneSpecifies that no confirmation is applied. The InkAnalyzer is free to change a context node or any of its descendants as needed.
NodeTypeAndPropertiesSpecifies that the InkAnalyzer cannot change type or any properties of the specified context node.
TopBoundarySpecifies that the InkAnalyzer will not perform operations, including adding ink or merging with other ContextNode objects, that cause the top boundary of the specified ContextNode to move beyond its current top boundary.

You can use NodeTypeAndProperties for ContextNode objects only of type InkWord and InkDrawing. Otherwise, an InvalidOperationException is thrown.

Use TopBoundary to ensure that InkAnalyzer does NOT perform any operations including adding ink or merging with other ContextNode objects. Otherwise, the top boundary of the ContextNode can move beyond the current boundary, causing the ContextNode to expand. For example, assume that the user of an application writes a paragraph. During analysis, InkAnalyzer creates a ParagraphNode for that paragraph. The application can then call Confirm, passing in TopBoundary. If the user adds new ink above the paragraph, the InkAnalyzer will not incorporate the new ink into the confirmed ParagraphNode when InkAnalyzer performs analysis on the new ink.

NoteNote:

When using TopBoundary, the ContextNode can continue to expand in other directions. Deleting strokes can cause the top boundary of the ContextNode to move down. Translating the ContextNode can cause the location to change, but will not allow additional ink to be merged in the new location.

This TopBoundary is applicable only to paragraph nodes.

The following example allows the user to indicate which strokes have been analyzed correctly. This example is an event handler for a PreviewMouseUp event on an InkCanvas named theInkCanvas. When the CheckBox, confirmMode, is checked, the user clicks a word to confirm it (or to turn off confirmation if the node is already confirmed). The example uses StrokeCollection.HitTest(Point) and FindNodesOfType to find the appropriate nodes. After the nodes are found, Confirm is called to toggle the confirmation. Finally, the TreeView is rebuilt to show which nodes have been confirmed and the PreviewMouseUp event is handled.

void theInkCanvas_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    if ((bool)this.confirmMode.IsChecked)
    {
        // Find the ink word nodes that correspond to those strokes
        Point position = e.GetPosition(theInkCanvas);
        StrokeCollection hitStrokes = theInkCanvas.Strokes.HitTest(position);

        ContextNodeCollection selectedNodes =
            this.theInkAnalyzer.FindNodesOfType(ContextNodeType.InkWord,
            hitStrokes);

        // Toggle the confirmation type on these nodes 
        foreach (ContextNode selectedNode in selectedNodes)
        {
            if (selectedNode.IsConfirmed(ConfirmationType.NodeTypeAndProperties))
            {
                selectedNode.Confirm(ConfirmationType.None);
            }
            else
            {
                selectedNode.Confirm(ConfirmationType.NodeTypeAndProperties);
            }
        }

        // Rebuild the TreeView to show which context nodes are confirmed. 
        this.BuildTree();

        // Handle the MouseDown event to prevent the InkCanvas from 
        // selecting the stroke.
        e.Handled = true;
    }
}

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

Reference

ContextNodeIsNodeTypeAndPropertiesConfirmed

Community Additions

ADD
Show:
© 2014 Microsoft