Kanzi 3.9.10
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/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// In the RootPage node create a Page node named Intro.
var introPage = studio.ActiveProject.CreateProjectItem<Page>(rootPage.GenerateUniqueChildName("Intro"), rootPage);
// In the RootPage node create a Page node named Main.
studio.ActiveProject.CreateProjectItem<Page>(rootPage.GenerateUniqueChildName("Main"), rootPage);
// Create a node reference using a relative path from the Intro Page node to the Main Page node.
// Get the target node of the node reference that you created.
// Use the Intro Page node as the context for resolving the relative path to the Main Page node.
// Print the absolute path to the target node to the Kanzi Studio Log window.
studio.Log(target.Path);
}