Share via


ContextNode.Strokes Property

Gets the StrokeCollection associated with this ContextNode.

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

Syntax

'Declaration
Public ReadOnly Property Strokes As StrokeCollection
'Usage
Dim instance As ContextNode 
Dim value As StrokeCollection 

value = instance.Strokes
public StrokeCollection Strokes { get; }
public:
property StrokeCollection^ Strokes {
    StrokeCollection^ get ();
}
public function get Strokes () : StrokeCollection

Property Value

Type: System.Windows.Ink.StrokeCollection
The StrokeCollection associated with this ContextNode.

Remarks

If the ContextNode is not a leaf node, this property returns the strokes that comprise all of its leaf descendants.

If the node is of a type that does not have strokes (such as TextWordNode, ImageNode, or AnalysisHintNode), this property returns an empty strokes collection.

Examples

This example is a method that assigns red DrawingAttributes to the strokes of a ContextNode while assigning default drawing attributes to all other strokes. An InkCanvas named theInkCanvas collects the strokes.

Sub MarkNodeAsRed(ByVal selectedNode As ContextNode)
    ' Set all node strokes to black, but this one to red 
    Dim stroke As Stroke
    For Each stroke In Me.theInkCanvas.Strokes
        If Not (selectedNode Is Nothing) AndAlso selectedNode.Strokes.Contains(stroke) Then
            stroke.DrawingAttributes.Color = Colors.Red
        Else
            stroke.DrawingAttributes.Color = Me.theInkCanvas.DefaultDrawingAttributes.Color
        End If 
    Next stroke

End Sub 'theResultsTreeView_SelectedItemChanged 
private void MarkNodeAsRed(ContextNode selectedNode)
{
    // Set all node strokes to black, but this one to red 
    foreach (Stroke stroke in this.theInkCanvas.Strokes)
    {
        if (selectedNode != null &&
            selectedNode.Strokes.Contains(stroke))
            stroke.DrawingAttributes.Color = Colors.Red;
        else
            stroke.DrawingAttributes.Color = 
                this.theInkCanvas.DefaultDrawingAttributes.Color;
    }
}

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

ContextNode Class

ContextNode Members

System.Windows.Ink Namespace

System.Windows.Ink.StrokeCollection