Kanzi  3.9.4
Kanzi Studio API
ProjectItem Interface Reference

Access nodes and resources in a Kanzi Studio project. More...

Inheritance diagram for ProjectItem:
[legend]
Collaboration diagram for ProjectItem:
[legend]

Public Member Functions

void AddProperty (string propertyName)
 Adds a property to an item. More...
 
void AddProperty (Property property)
 Adds a property to an item. More...
 
void BeginBatchModification (string batchName)
 
bool CanAddProperty (string propertyName)
 Checks whether Kanzi Studio allows you to add a specific property to an item. More...
 
bool CanAddProperty (Property property)
 Checks whether Kanzi Studio allows you to add a specific property to an item. More...
 
void CommitBatchModification ()
 
bool Delete ()
 Deletes a project item. More...
 
void DeregisterThumbnailUser (object user)
 Deregisters a registerd thumbnail user. More...
 
IEnumerable< PropertyGetAddableProperties ()
 Gets a list of properties which you can add to an item. More...
 
GetAncestor< T > ()
 Gets the nearest item of given type in the parent tree. More...
 
ProjectItem GetChild (string childName)
 Gets the child item of the current item with the given name. More...
 
GetChild< T > (string childName)
 Gets the child item of the current item with the given name and type. More...
 
int GetChildIndex (ProjectItem child)
 
IEnumerable< PropertyGetContextProperties ()
 
IEnumerable< PropertyGetFixedProperties ()
 
IEnumerable< PropertyGetFrequentlyAddedProperties ()
 
ProjectItem GetProjectItemByPath (string path)
 
string GetRelativeProjectPathTo (ProjectItem anotherItem)
 
IEnumerable< PropertyGetRemovableProperties ()
 Gets a list of properties which you can remove from an item. More...
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode)
 Gets the thumbnail image for a project item. More...
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode, float[] letterboxColorRGBA)
 Gets the thumbnail image for a project item. More...
 
IEnumerable< ProjectItemGetTreeItemsAsList ()
 Enumerates the items under this ProjectItem including this item itself, children, and grand children. More...
 
bool HasProperty (string propertyName)
 Checks whether an item has a specific property. More...
 
bool HasProperty (Property property)
 Checks whether an item has a specific property. More...
 
bool IsPropertyReadOnly (Property property)
 
void RegisterThumbnailUser (object user, uint width, uint height, bool showChildren, bool showFullScreen, Node contextNode)
 Registers a user for the thumbnail images for a project item. More...
 
void RemoveProperty (string propertyName)
 Removes a property from an item. More...
 
void RemoveProperty (Property property)
 Removes a property from an item. More...
 
void SetChildIndex (ProjectItem child, int index)
 
void SetPropertyReadOnlyStatus (Property property, bool? value)
 
void UpdateValidity ()
 Recalculates the validity the item. More...
 
- Public Member Functions inherited from PropertyContainer
object Get (string propertyName)
 Gets the value of a property. More...
 
object Get (Property property)
 Gets the value of a property. More...
 
Get< T > (TypedProperty< T > property)
 Gets the value of a property. More...
 
void Set (string propertyName, object value)
 Sets the value of a property. More...
 
void Set< T > (TypedProperty< T > property, T value)
 Sets the value of a property. More...
 
- Public Member Functions inherited from ChildContainer
string GenerateUniqueChildName (string defaultName)
 Generates a unique name. More...
 
string GetInvalidityReasonOfNewName (string newName)
 Returns the reason why the passed name is not valid. More...
 

Properties

IEnumerable< ProjectItemChildren [get]
 Gets all child items of a project item. More...
 
string IconLocation [get]
 
object IconModifier [get, set]
 
string InvalidityReason [get]
 
bool IsDeleted [get]
 
bool IsDisposed [get]
 
bool IsHidden [get, set]
 
bool IsReadOnly [get, set]
 
bool IsValidState [get]
 
string KzbUrl [get]
 Gets the kzb URL of a project item. More...
 
string Name [get, set]
 Gets or sets the name of a project item. More...
 
ProjectItem Parent [get, set]
 
string Path [get]
 
Project Project [get]
 Gets the project in which this item is located. More...
 
Type ProjectItemType [get]
 
PropertyTypeLibrary PropertyTypeLibrary [get]
 Gets the Property Types library of the project of this item which stores all property types you create in a Kanzi Studio project. More...
 
object this[Property property] [get, set]
 
object this[string propertyName] [get, set]
 
string ToolTip [get]
 
string TypeDisplayName [get]
 Gets the type of a project item. More...
 
- Properties inherited from PropertyContainer
IEnumerable< PropertyProperties [get]
 Gets the properties in a project item or node component. More...
 

Events

EventHandler< CollectionChangedEventArgs< ProjectItem > > ChildCollectionChanged
 
EventHandler< DeletedEventArgs > Deleted
 
EventHandler< DeletedEventArgs > Deleting
 
EventHandler< CollectionChangedEventArgs< ProjectItem > > DescendantChildCollectionChanged
 
EventHandler< DeletedEventArgs > DescendantDeleted
 
EventHandler< DynamicPropertyChangedEventArgs > DescendantDynamicPropertyChanged
 
EventHandler< ParentChangedEventArgs > DescendantParentChanged
 
EventHandler< CollectionChangedEventArgs< string > > DescendantPropertyCollectionChanged
 
EventHandler< ProjectItemEventArgs > Disposing
 
EventHandler< DynamicPropertyChangedEventArgs > DynamicPropertyChanged
 
EventHandler< ParentChangedEventArgs > ParentChanged
 
EventHandler< PathChangedEventArgs > PathChanged
 
EventHandler< DynamicPropertyChangedEventArgs > PreviewDescendantDynamicPropertyChanged
 
EventHandler< DynamicPropertyChangedEventArgs > PreviewDynamicPropertyChanged
 
EventHandler< CollectionChangedEventArgs< string > > PropertyCollectionChanged
 
EventHandler< ReplaceEventArgs > Replacing
 
EventHandler ThumbnailChanged
 
EventHandler ValidityChanged
 

Detailed Description

Access nodes and resources in a Kanzi Studio project.

For example, use this class to get a node, add, remove, or set its properties, find out about its relations to other nodes, get notifications about changes to that node, and to delete the node.

Member Function Documentation

◆ AddProperty() [1/2]

void AddProperty ( string  propertyName)

Adds a property to an item.

When you add a property to a node, the initial value of the property is the default value set for that property. Use the Set function to set the value of a property.

Parameters
propertyNameThe name of the property to add.
See also
AddProperty(Property), RemoveProperty(string), RemoveProperty(Property)

Examples

To add a property to a node and set the value of the property:

// To add a property to a node, first get or create that node, then use the AddProperty function
// to add the property. Use the Set function to set the value of a property.
public void Execute(PluginCommandParameter parameter)
{
// Get the node to which you want to add a property.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Add the Layout Width property to the RootPage node you got in the previous line.
rootPage.AddProperty("Node.Width");
// Set the value of the Layout Width property to 1280.
rootPage.Set("Node.Width", 1280);
}

To add a property to a node and set the value of the property to a resource:

// To add a property to a node, first get or create that node, then use the AddProperty function
// to add the property. Use the Set function to set the value of a property.
public void Execute(PluginCommandParameter parameter)
{
// Get the node to which you want to add a node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Page node named Home in the RootPage node you got in the previous line.
var homePage = studio.ActiveProject.CreateProjectItem<Page>(
rootPage.GenerateUniqueChildName("Home"), rootPage);
// Add the Background Brush property to the Home node.
homePage.AddProperty("Node2D.BackgroundBrush");
// Get the DefaultBackground brush in the Brushes library.
var defaultBackgroundBrush = studio.ActiveProject.BrushLibrary.GetItemByName("DefaultBackground");
// Set the Background Brush property of the Home node to the DefaultBackground brush.
homePage.Set("Node2D.BackgroundBrush", defaultBackgroundBrush);
}

◆ AddProperty() [2/2]

void AddProperty ( Property  property)

Adds a property to an item.

When you add a property to a node, the initial value of the property is the default value set for that property. Use the Set function to set the value of a property.

Parameters
property
See also
AddProperty(string), RemoveProperty(Property), RemoveProperty(string)

Examples

To add a property to a node:

// To add a property to a node, first get or create that node, then use the AddProperty function
// to add the property. Use the Set function to set the value of a property.
public void Execute(PluginCommandParameter parameter)
{
// Get the node to which you want to add a node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Page node named Home in the RootPage node you got in the previous line.
var homePage = studio.ActiveProject.CreateProjectItem<Page>(
rootPage.GenerateUniqueChildName("Home"), rootPage);
// Add the Background Brush property to the Home node.
homePage.AddProperty(Properties.Node2DBackgroundBrush);
// Get the DefaultBackground brush in the Brushes library.
var defaultBackgroundBrush = studio.ActiveProject.BrushLibrary.GetItemByName("DefaultBackground");
// Set the Background Brush property of the Home node to the DefaultBackground brush.
homePage.Set(
homePage.PropertyTypes.Node2DBackgroundBrush,
new ResourceReference<Brush>(defaultBackgroundBrush));
}

◆ CanAddProperty() [1/2]

bool CanAddProperty ( string  propertyName)

Checks whether Kanzi Studio allows you to add a specific property to an item.

Parameters
propertyNameThe name of the property.
Returns
True when you can add the property to the item, otherwise false.
See also
CanAddProperty(Property), HasProperty(string), HasProperty(Property)

Examples

To check whether Kanzi Studio allows you to add a specific property to a node:

// To check whether you can add a specific property to a node, first get that node, then
// use the CanAddProperty function to check whether you can add the property.
public void Execute(PluginCommandParameter parameter)
{
// Get the node for which you want to check whether you can add a specific property.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// If you can add the Background Brush to the node that you got on the previous line, add it.
if (rootPage.CanAddProperty("Node2D.BackgroundBrush"))
{
rootPage.AddProperty("Node2D.BackgroundBrush");
}
}

◆ CanAddProperty() [2/2]

bool CanAddProperty ( Property  property)

Checks whether Kanzi Studio allows you to add a specific property to an item.

Parameters
propertyThe property.
Returns
True when you can add the property to the item, otherwise false.
See also
CanAddProperty(string), HasProperty(Property), HasProperty(string)

Examples

To check whether Kanzi Studio allows you to add a specific property to a node:

// To check whether you can add a specific property to a node, first get that node, then
// use the CanAddProperty function to check whether you can add the property.
public void Execute(PluginCommandParameter parameter)
{
// Get the node for which you want to check whether you can add a specific property.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// If you can add the Background Brush to the node that you got on the previous line, add it.
if (rootPage.CanAddProperty(Properties.Node2DBackgroundBrush))
{
rootPage.AddProperty(Properties.Node2DBackgroundBrush);
}
}

◆ Delete()

bool Delete ( )

Deletes a project item.

Returns
When it deletes the item successfully, true, otherwise false.

Examples

To delete a node from the node tree:

// To delete a node you first have to get it, and then use the Delete function to delete it.
public void Execute(PluginCommandParameter parameter)
{
// Get the parent node of the node you want to delete.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Get the node you want to delete.
var defaultViewport2D = rootNode.GetChild("Viewport 2D");
// Delete the node.
defaultViewport2D.Delete();
}

◆ DeregisterThumbnailUser()

void DeregisterThumbnailUser ( object  user)

Deregisters a registerd thumbnail user.

Parameters
userThe registered thumbnail user you want to deregister.
See also
GetThumbnail(int, int, bool, bool, Node), RegisterThumbnailUser

◆ GetAddableProperties()

IEnumerable<Property> GetAddableProperties ( )

Gets a list of properties which you can add to an item.

Returns
A list of properties as Property object types which you can add to an item.
See also
GetRemovableProperties, AddProperty(string), AddProperty(Property)

Examples

To get a list of properties which you can add to a node:

public void Execute(PluginCommandParameter parameter)
{
// Get the node for which you want to get a list of the properties that you can add.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Get the list of properties that you can add and iterate through the list.
foreach (Property property in rootPage.GetAddableProperties())
{
// Print to the Kanzi Studio Log window the names of properties you can add.
studio.Log(property.Name);
}
}

◆ GetAncestor< T >()

T GetAncestor< T > ( )

Gets the nearest item of given type in the parent tree.

The parent tree starts from the item itself, then this.Parent, then this.Parent.Parent, and so on.

Template Parameters
TThe type looked for
Type Constraints
T :class 
T :ProjectItem 

◆ GetChild()

ProjectItem GetChild ( string  childName)

Gets the child item of the current item with the given name.

For example, use this function to get the child nodes of the current node, or items in any of the Kanzi Studio project libraries, such as Brushes, Textures, Styles, and so on.

Parameters
childNameThe name of the child item you want to get with this function.
Returns
The child item with matching name, or null if not found.
See also
Children

Examples

To get a node:

// To get a node you first have to get its parent node, and then use the GetChild function to get its child node.
public void Execute(PluginCommandParameter parameter)
{
// Get the parent node of the node you want to get.
var parentNode = studio.ActiveProject.GetProjectItem("Screens/Screen");
// Get the RootPage node in the Screens/Screen node.
var rootPage = parentNode.GetChild("RootPage");
}

To get a resource:

// To get a resource you first have to get the library where the resource is stored,
// and then use the GetChild function to get the resource in that library.
public void Execute(PluginCommandParameter parameter)
{
// Get the Brushes library which stores all the brushes in a Kanzi Studio project.
var brushLibrary = studio.ActiveProject.BrushLibrary;
// Get the DefaultBackground texture brush from the Brushes library.
var defaultBackground = brushLibrary.GetItemByName("DefaultBackground");
}

◆ GetChild< T >()

T GetChild< T > ( string  childName)

Gets the child item of the current item with the given name and type.

For example, use this function to get the child nodes of the current node, or items in any of the Kanzi Studio project libraries, such as Brushes, Textures, Styles, and so on.

Template Parameters
TThe type of the item you want to get with this function.
Parameters
childNameThe name of the child item you want to get with this function.
Returns
The child item with matching name and type, or null if not found.
See also
Children

Examples

To get a node:

// To get a node you first have to get its parent node, and then use the GetChild function to get its child node.
public void Execute(PluginCommandParameter parameter)
{
// Get the parent node of the node you want to get.
var parentNode = studio.ActiveProject.GetProjectItem("Screens/Screen");
// Get the RootPage node in the Screens/Screen node.
var rootPage = parentNode.GetChild<Page>("RootPage");
}

To get a resource:

// To get a resource you first have to get the library where the resource is stored,
// and then use the GetChild function to get the resource in that library.
public void Execute(PluginCommandParameter parameter)
{
// Get the Brushes library which stores all the brushes in a Kanzi Studio project.
var brushLibrary = studio.ActiveProject.BrushLibrary;
// Get the DefaultBackground texture brush from the Brushes library.
var defaultBackground = brushLibrary.GetChild<Brush>("DefaultBackground");
}
Type Constraints
T :ProjectItem 

◆ GetRemovableProperties()

IEnumerable<Property> GetRemovableProperties ( )

Gets a list of properties which you can remove from an item.

Returns
A list of properties as Property object types which you can remove from an item.
See also
GetAddableProperties, RemoveProperty(string), RemoveProperty(Property)

Examples

To get a list of properties which you can remove from a node:

public void Execute(PluginCommandParameter parameter)
{
// Get the node for which you want to get a list of the properties that you can remove.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Get the list of properties that you can remove and iterate through the list.
foreach (Property property in rootPage.GetRemovableProperties())
{
// Print to the Kanzi Studio Log window the names of properties you can remove.
studio.Log(property.Name);
}
}

◆ GetThumbnail() [1/2]

BitmapSource GetThumbnail ( int  width,
int  height,
bool  showChildren,
bool  showFullScreen,
Node  contextNode 
)

Gets the thumbnail image for a project item.

If you use the RegisterThumbnailUser function, Kanzi makes the image availabe in cache for quick retrival, otherwise the rendering of the thumbnail takes more time.

Parameters
widthThe width of the thumbnail image.
heightThe height of the thumbnail image.
showChildrenIf set to true [show children].
showFullScreenIf set to true [show full screen].
contextNodeThe context node for resources, such as states, that require a node to display themselves in.
Returns
The thumbnail image of the project item.

◆ GetThumbnail() [2/2]

BitmapSource GetThumbnail ( int  width,
int  height,
bool  showChildren,
bool  showFullScreen,
Node  contextNode,
float []  letterboxColorRGBA 
)

Gets the thumbnail image for a project item.

If you use the RegisterThumbnailUser function, Kanzi makes the image availabe in cache for quick retrival, otherwise the rendering of the thumbnail takes more time.

Parameters
widthThe width of the thumbnail image.
heightThe height of the thumbnail image.
showChildrenIf set to true [show children].
showFullScreenIf set to true [show full screen].
contextNodeThe context node for resources, such as states, that require a node to display themselves in.
letterboxColorRGBALetter box color
Returns
The thumbnail image of the project item.

◆ GetTreeItemsAsList()

IEnumerable<ProjectItem> GetTreeItemsAsList ( )

Enumerates the items under this ProjectItem including this item itself, children, and grand children.

Returns

◆ HasProperty() [1/2]

bool HasProperty ( string  propertyName)

Checks whether an item has a specific property.

For example, use this function to check for the presence of a specific property before trying to add or remove that property from an item.

Parameters
propertyNameThe name of the property the presence of which you want to check.
Returns
True when the item has the specified property, otherwise false.
See also
AddProperty(string), AddProperty(Property), RemoveProperty(string), RemoveProperty(Property), CanAddProperty(string), CanAddProperty(Property)

Examples

To check whether a node has a specific property:

// To check whether a node has a specific property, first get that node, then use
// the HasProperty function to check whether the node has that property.
public void Execute(PluginCommandParameter parameter)
{
// Get the node for which you want to check whether it has a specific property.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Check whether the RootPage node has the Background Brush property.
bool hasProperty = rootPage.HasProperty("Node2D.BackgroundBrush");
// If the RootPage node does not have the Background Brush property, add it.
if (!hasProperty)
{
rootPage.AddProperty("Node2D.BackgroundBrush");
}
}

◆ HasProperty() [2/2]

bool HasProperty ( Property  property)

Checks whether an item has a specific property.

For example, use this function to check for the presence of a specific property before trying to add or remove that property from an item.

Parameters
propertyThe property the presence of which you want to check.
Returns
True when the item has the specified property, otherwise false.
See also
AddProperty(string), AddProperty(Property), RemoveProperty(string), RemoveProperty(Property), CanAddProperty(string), CanAddProperty(Property)

Examples

To check whether a node has a specific property:

// To check whether a node has a specific property, first get that node, then use
// the HasProperty function to check whether the node has that property.
public void Execute(PluginCommandParameter parameter)
{
// Get the node for which you want to check whether it has a specific property.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Check whether the RootPage node has the Background Brush property.
bool hasProperty = rootPage.HasProperty(Properties.Node2DBackgroundBrush);
// If the RootPage node does not have the Background Brush property, add it.
if (!hasProperty)
{
rootPage.AddProperty(Properties.Node2DBackgroundBrush);
}
}

◆ RegisterThumbnailUser()

void RegisterThumbnailUser ( object  user,
uint  width,
uint  height,
bool  showChildren,
bool  showFullScreen,
Node  contextNode 
)

Registers a user for the thumbnail images for a project item.

Registering allows you to retrieve thumbnail images in the background before Kanzi sets off the ThumbnailChanged event. After registering, the calls to the GetThumbnail retrieve the cached thumbnail image faster than if you do not register. You must deregister using the DeregisterThumbnailUser function when you are not using the thumbnail images anymore.

Parameters
userThe user.
widthThe width of the thumbnail image.
heightThe height of the thumbnail image.
showChildrenIf set to true [show children].
showFullScreenIf set to true [show full screen].
contextNodeThe context node for resources, such as states, that require a node to display themselves in.
See also
GetThumbnail(int, int, bool, bool, Node), DeregisterThumbnailUser

◆ RemoveProperty() [1/2]

void RemoveProperty ( string  propertyName)

Removes a property from an item.

Parameters
propertyNameThe name of the property to remove.
See also
RemoveProperty(Property), AddProperty(string), AddProperty(Property)

Examples

To remove a property from a node:

// To remove a property from a node, first get that node, then use the RemoveProperty function
// to remove the property.
public void Execute(PluginCommandParameter parameter)
{
// Get the node from which you want to remove a property.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Remove the Background Brush property from the RootPage node you got in the previous line.
rootPage.RemoveProperty("Node2D.BackgroundBrush");
}

◆ RemoveProperty() [2/2]

void RemoveProperty ( Property  property)

Removes a property from an item.

Parameters
propertyThe property to remove.
See also
RemoveProperty(string), AddProperty(Property), AddProperty(string)

Examples

To remove a property from a node:

// To remove a property from a node, first get that node, then use the RemoveProperty function
// to remove the property.
public void Execute(PluginCommandParameter parameter)
{
// Get the node from which you want to remove a property.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Remove the Background Brush property from the RootPage node you got in the previous line.
rootPage.RemoveProperty(Properties.Node2DBackgroundBrush);
}

◆ UpdateValidity()

void UpdateValidity ( )

Recalculates the validity the item.

This can be called if there has happened an external change that affects the validity but has not triggered change in the item itself. This situation can arise e.g. when implementing EditTimeComponentPlugin that returns problem descriptions based on the state of other nodes than the current one.

Property Documentation

◆ Children

IEnumerable<ProjectItem> Children
get

Gets all child items of a project item.

See also
GetChild(string), GetChild<T>(string)

Examples

To get all child nodes of a node:

public void Execute(PluginCommandParameter parameter)
{
// Get all child nodes of the RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage").Children;
// Print the name of each child node of the RootPage node to the Kanzi Studio Log window.
foreach (var node in rootPage)
{
studio.Log(node.Name);
}
}

To get all resources from a library:

public void Execute(PluginCommandParameter parameter)
{
// Get all images from the Images directory.
var imagesDirectory = studio.ActiveProject.ImageDirectory.Children;
// Print the name of all images in the Images directory to the Kanzi Studio Log window.
foreach (var resource in imagesDirectory)
{
studio.Log(resource.Name);
}
}

◆ KzbUrl

string KzbUrl
get

Gets the kzb URL of a project item.

The kzb URL gives you the exact location of a project item. For example, you can use the kzb URL to access a node or a resource in a JavaScript script in your Kanzi application.

Examples

To get the kzb URL of a node:

public void Execute(PluginCommandParameter parameter)
{
// Get the node whose type you want to get.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Print the .kzb URL of the node to the Kanzi Studio Log window.
studio.Log(rootNode.KzbUrl);
}

To get the kzb URL of a resource:

public void Execute(PluginCommandParameter parameter)
{
// Get the resource whose type you want to get.
var texturesLibrary = studio.ActiveProject.TextureLibrary;
var defaultTexture = texturesLibrary.GetItemByName("Default Texture");
// Print the .kzb URL of the resource to the Kanzi Studio Log window.
studio.Log(defaultTexture.KzbUrl);
}

◆ Name

string Name
getset

Gets or sets the name of a project item.

This is the same value as the value of the Name property. The name must be unique among children of the same parent.

Examples

To get the name of a node:

public void Execute(PluginCommandParameter parameter)
{
// Get the node whose name you want to get.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Print the name of the node to the Kanzi Studio Log window. In this example it prints "RootPage".
studio.Log(rootNode.Name);
}

To get the name of a resource:

public void Execute(PluginCommandParameter parameter)
{
// Get the resource whose name you want to get.
var texturesLibrary = studio.ActiveProject.TextureLibrary;
var defaultTexture = texturesLibrary.GetItemByName("Default Texture");
// Print the name of the resource to the Kanzi Studio Log window. In this example it prints "Default Texture".
studio.Log(defaultTexture.Name);
}

◆ Project

Gets the project in which this item is located.

◆ PropertyTypeLibrary

Gets the Property Types library of the project of this item which stores all property types you create in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

Examples

To get all property types in the Property Types library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library which stores all property types you create in a Kanzi Studio project.
var propertyTypesLibrary = studio.ActiveProject.PropertyTypeLibrary;
foreach (Property property in propertyTypesLibrary.ProjectPropertyTypes)
{
// Print the name of all properties which you can remove to the Kanzi Studio Log window.
studio.Log(property.Name);
}
}

To create your own property type of the integer data type:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library which stores all property types you create in a Kanzi Studio project.
var propertyTypesLibrary = studio.ActiveProject.PropertyTypeLibrary;
// Create an integer property type in the Property Types library and set:
// - Name to MyIntProperty
// - Name as it is shown in Kanzi Studio to My Int Property
// - Category in which Kanzi Studio shows the property type to My Properties
// - Lowest value to 0
// - Highest value to 9000
// - The amount by which the property can change to 10
var myIntProperty = studio.ActiveProject.PropertyTypeLibrary.CreateIntProperty(
propertyTypesLibrary.GenerateUniqueChildName("MyIntProperty"),
"My Int Property",
"My Properties",
0,
9000,
10);
}

◆ TypeDisplayName

string TypeDisplayName
get

Gets the type of a project item.

Examples

To get the type of a node:

public void Execute(PluginCommandParameter parameter)
{
// Get the node whose type you want to get.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Print the type of the node to the Kanzi Studio Log window. In this example it prints "Page Host".
studio.Log(rootNode.TypeDisplayName);
}

To get the type of a resource:

public void Execute(PluginCommandParameter parameter)
{
// Get the resource whose type you want to get.
var texturesLibrary = studio.ActiveProject.TextureLibrary;
var defaultTexture = texturesLibrary.GetItemByName("Default Texture");
// Print the type of the resource to the Kanzi Studio Log window. In this example it prints "Single Texture".
studio.Log(defaultTexture.TypeDisplayName);
}