Kanzi 4.0.0-beta2
ProjectItemReference< out T > Interface Template Reference

Create project item references. More...

Public Member Functions

T GetTarget (Node context)
 Gets the node to which a relative node reference points.
 

Properties

bool IsAbsoluteReference [get]
 Gets whether a project item reference is an absolute reference.
 

Detailed Description

Create project item references.

See NodeReference and ResourceReference.

Template Parameters
T
Type Constraints
T :class 
T :ProjectItem 

Member Function Documentation

◆ GetTarget()

T GetTarget ( Node context)

Gets the node to which a relative node reference points.

Parameters
contextThe node that you use to resolve the relative path to the target node.
Returns
The node to which a relative node reference points.

Examples

To get the node to which a relative node reference points:

{
// Get the Screens/Screen/RootNode node.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootNode");
// In the RootNode node create a EmptyNode2D node named Intro.
var introNode = studio.ActiveProject.CreateProjectItem<EmptyNode2D>(rootNode.GenerateUniqueChildName("Intro"), rootNode);
// In the RootNode node create a EmptyNode2D node named Main.
studio.ActiveProject.CreateProjectItem<EmptyNode2D>(rootNode.GenerateUniqueChildName("Main"), rootNode);
// Create a node reference using a relative path from the Intro node to the Main node.
// Get the target node of the node reference that you created.
// Use the Intro node as the context for resolving the relative path to the Main node.
// Print the absolute path to the target node to the Kanzi Studio Log window.
studio.Log(target.Path);
}