Partager via


DataViewHierarchyAccessor.SetNodePath Method

Sets the node path for a node identified by a particular item ID.

Namespace:  Microsoft.VisualStudio.Data
Assembly:  Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)

Syntax

'Declaration
Public Sub SetNodePath ( _
    itemId As Integer, _
    nodePath As String _
)
public void SetNodePath(
    int itemId,
    string nodePath
)
public:
void SetNodePath(
    int itemId, 
    String^ nodePath
)
member SetNodePath : 
        itemId:int * 
        nodePath:string -> unit
public function SetNodePath(
    itemId : int, 
    nodePath : String
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

The nodePath parameter is null.

ArgumentException

The specified itemID is invalid.

Remarks

This method is very powerful in that it allows you to contextualize or relocate any node in the data view hierarchy. It should be used in two different scenarios.

The first is when a new object is created. A data provider first calls the CreateObjectNode method to produce a contextless item ID that can be used while designing the new object. When this object is saved, the data provider will want to add this item to the hierarchy tree. This is achieved by calling the SetNodePath method and providing the correct node path to the location of the new node.

The second scenario occurs when the object is being modified and should be relocated to a different part of the hierarchy. Again, when the object is saved with updated properties, the data provider should call the SetNodePath method to move the node to the new location.

.NET Framework Security

See Also

Reference

DataViewHierarchyAccessor Class

Microsoft.VisualStudio.Data Namespace