Compartir a través de


ContextNode.ParentNode Property

Gets the parent node of the ContextNode in the context node tree.

Namespace: System.Windows.Ink
Assembly: IAWinFX (in iawinfx.dll)
XML Namespace:  https://schemas.microsoft.com/winfx/2006/xaml/presentation

Syntax

'Declaration
Public ReadOnly Property ParentNode As ContextNode
'Usage
Dim instance As ContextNode
Dim value As ContextNode

value = instance.ParentNode
public ContextNode ParentNode { get; }
public:
property ContextNode^ ParentNode {
    ContextNode^ get ();
}
/** @property */
public ContextNode get_ParentNode ()
public function get ParentNode () : ContextNode
Not applicable.

Property Value

The parent node of the ContextNode.

Remarks

Returns a null reference (Nothing in Visual Basic) if this is the RootNode.

Example

This example uses a System.Windows.Controls.TreeView, theTreeView, where each TreeViewItem has its System.Windows.FrameworkElement.Tag property set to a ContextNode. It finds the selected node and then uses ParentNode to find its parent. After the parent node is found, it calls the MarkNodeAsRed method to change the node's strokes to red.

Dim selectedNode As ContextNode = CType(selectedTreeItem.Tag, ContextNode)
Dim parentNode As ContextNode = selectedNode.ParentNode
If Not (parentNode Is Nothing) Then
    MarkNodeAsRed(parentNode)
End If
ContextNode selectedNode = (ContextNode)selectedTreeItem.Tag;
ContextNode parentNode = selectedNode.ParentNode;
if (parentNode != null)
{
    MarkNodeAsRed(parentNode);
}

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

ContextNode Class
ContextNode Members
System.Windows.Ink Namespace
ContextNode.SubNodes