Kanzi  3.9.9
Kanzi Studio plugin API
ProjectItemReference< out out T > Interface Template Reference

Create project item references. More...

Public Member Functions

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

Properties

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

Detailed Description

Create project item references.

See NodeReference and ResourceReference.

Template Parameters
T
Type Constraints
T :class 
T :ProjectItem 

Member Function Documentation

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:

public void Execute(PluginCommandParameter parameter)
{
// 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.
ProjectItemReference<ExportedPropertyContainerItem> routingTarget = new NodeReference<Page>("../Main");
// 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.
var target = routingTarget.GetTarget(introPage);
// Print the absolute path to the target node to the Kanzi Studio Log window.
studio.Log(target.Path);
}

Property Documentation

bool IsAbsoluteReference
get

Gets whether a project item reference is an absolute reference.