Share via


MatchesCriteriaCallback Delegate

Represents a function that is used to evaluate if a ContextNode object meets or fails a specified criteria.

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

Syntax

'Declaration
Public Delegate Function MatchesCriteriaCallback ( _
    visitingNode As ContextNode, _
    data As Object _
) As Boolean
'Usage
Dim instance As New MatchesCriteriaCallback(AddressOf HandlerMethod)
public delegate bool MatchesCriteriaCallback(
    ContextNode visitingNode,
    Object data
)
public delegate bool MatchesCriteriaCallback(
    ContextNode^ visitingNode, 
    Object^ data
)
JScript does not support delegates.

Parameters

  • data
    Type: System.Object

    Optional data that can be used for the criteria.

Return Value

Type: System.Boolean
true if visitingNode matches the criteria; otherwise false.

Examples

The following example finds the collection of ContextNode objects in an InkAnalyzer, theInkAnalyzer, that satisfies the criteria specified in the MatchesCriteriaCallBack delegate function, LineIsLowerThan, by using an integer, yValue.

Dim lineIsLowerThanCallback As New MatchesCriteriaCallback(AddressOf LineIsLowerThan)
Dim nodesBelowYValue As ContextNodeCollection = theInkAnalyzer.FindNodes(lineIsLowerThanCallback, yValue)
MatchesCriteriaCallback
    lineIsLowerThanCallback = new MatchesCriteriaCallback(LineIsLowerThan);
ContextNodeCollection nodesBelowYValue =
    theInkAnalyzer.FindNodes(lineIsLowerThanCallback, yValue);

LineIsLowerThan returns a true if the ContextNode is a LineNode and if the bottom of the bounding box is lower than an integer that is passed in. Therefore, the nodesBelowYValue collection contains all lines with strokes below the value, yValue. Remember that higher y values appear lower on the screen.

Public Function LineIsLowerThan(ByVal node As ContextNode, ByVal data As Object) As Boolean  
    ' Return false if not a line 
    If Not TypeOf node Is LineNode Then 
        Return False 
    End If  
    ' Check if bottom is lower than yValue passed in 
    Dim yValue As Double = System.Convert.ToDouble(data)
    Return node.Location.GetBounds().Bottom > yValue

End Function 'LineIsLowerThan
public bool LineIsLowerThan(ContextNode node, object data)
{
    // Return false if not a line 
    if (!(node is LineNode))
        return false;

    // Check if bottom is lower than yValue passed in 
    double yValue = (double)data;
    return (node.Location.GetBounds().Bottom > yValue);
}

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

System.Windows.Ink Namespace

InkAnalyzer.FindNodes