Public Member Functions | Properties | List of all members
PropertyTypeLibrary Interface Reference

Stores property types declared in the current Kanzi Studio project. More...

Inheritance diagram for PropertyTypeLibrary:
ChildContainer

Public Member Functions

Property CloneProperty (Property source, string name)
 Copies a property type. More...
 
CustomEnumProperty CreateCustomEnumProperty (string name, string displayName, string category, Dictionary< string, int > options)
 
FloatProperty CreateFloatProperty (string name, string displayName, string category, float?lowerBound, float?upperBound, float?step)
 Creates a property type of the float data type. More...
 
IntProperty CreateIntProperty (string name, string displayName, string category, int?lowerBound, int?upperBound, int?step)
 Creates a property type of the integer data type. More...
 
MessageProperty CreateMessageProperty (string name, string displayName, string category, IEnumerable< Property > argumentProperties)
 
Property CreateProperty (Type dataType, string name, string displayName, string category)
 Creates a property type of data type you specify. More...
 
TypedProperty< T > CreateProperty< T > (string name, string displayName, string category)
 Creates a property type of data type you specify. More...
 
Vector2DProperty CreateVector2DProperty (string name, string displayName, string category, Vector?lowerBound, Vector?upperBound, Vector?step)
 Creates a property type of the vector 2D data type. More...
 
Vector3DProperty CreateVector3DProperty (string name, string displayName, string category, Vector3D?lowerBound, Vector3D?upperBound, Vector3D?step)
 Creates a property type of the vector 3D data type. More...
 
Vector4DProperty CreateVector4DProperty (string name, string displayName, string category, Quaternion?lowerBound, Quaternion?upperBound, Quaternion?step)
 
void DeleteProperty (Property property)
 Deletes a property type from the Property Types library. More...
 
IEnumerable< PropertyEditorGetCompatiblePropertyEditors (Property property)
 Gets the property editors that Kanzi Studio can use to set the value of a property. More...
 
Property GetProperty (string name)
 Gets the property with given name either from ProjectPropertyTypes for DefaultPropertyTypes. 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< PropertyDefaultPropertyTypes [get]
 Gets the default Kanzi property types. More...
 
IEnumerable< PropertyProjectPropertyTypes [get]
 Gets the property types stored in the Property Types library. More...
 
IEnumerable< PropertyEditorPropertyEditors [get]
 

Detailed Description

Stores property types declared in the current Kanzi Studio project.

Factory for creating new property types.

See also
Property, PropertyEditor

Member Function Documentation

Property CloneProperty ( Property  source,
string  name 
)

Copies a property type.

The new property type inherits all its properties from the source property except for the name, which shall be different from the source property name to avoid clashes.

Parameters
sourceSource property type.
nameName of the cloned property type.
Returns
FloatProperty CreateFloatProperty ( string  name,
string  displayName,
string  category,
float?  lowerBound,
float?  upperBound,
float?  step 
)

Creates a property type of the float data type.

Parameters
nameThe name of the property that you use with the Kanzi Engine API. The name must be unique among the property types and must not contain spaces.
displayNameThe name of the property as it is shown in Kanzi Studio.
categoryThe category in which Kanzi Studio shows this property type.
lowerBoundThe lower value limit of the property. Set as null to use the default value of the data type.
upperBoundThe upper value limit of the property. Set as null to use the default value of the data type.
stepThe minimum amount by which the value of the property can change. Use null to set the default value.
Returns
The property type of the float data type.
See also
ProjectItem.PropertyTypeLibrary

Examples

To create a property type of the float data type:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library in the project.
var propertyTypesLibrary = studio.ActiveProject.PropertyTypeLibrary;
// Create a float property type in the Property Types library and set:
// - Name to MyPlugin.MyFloatProperty
// Use the name of your plugin as the property type namespace to avoid naming conflicts
// with other property types in the Kanzi Studio project that use the project name as
// the default property type namespace.
// - Name as it is shown in Kanzi Studio to My Float Property
// - Category in which Kanzi Studio shows the property type to My Plugin Properties
// - Lowest value to 0.0
// - Highest value to 100.0
// - The amount by which the property can change to 0.1
var myFloatProperty = propertyTypesLibrary.CreateFloatProperty(
propertyTypesLibrary.GenerateUniqueChildName("MyPlugin.MyFloatProperty"),
"My Float Property",
"My Plugin Properties",
0.0f,
100.0f,
0.1f);
}
IntProperty CreateIntProperty ( string  name,
string  displayName,
string  category,
int?  lowerBound,
int?  upperBound,
int?  step 
)

Creates a property type of the integer data type.

Parameters
nameThe name of the property that you use with the Kanzi Engine API. The name must be unique among the property types and must not contain spaces.
displayNameThe name of the property as it is shown in Kanzi Studio.
categoryThe category in which Kanzi Studio shows this property type.
lowerBoundThe lower value limit of the property. Set as null to use the default value of the data type.
upperBoundThe upper value limit of the property. Set as null to use the default value of the data type.
stepThe minimum amount by which the value of the property can change. Use null to set the default value.
Returns
The property type of the integer data type.
See also
ProjectItem.PropertyTypeLibrary

Examples

To create a property type of the integer data type:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library in the project.
var propertyTypesLibrary = studio.ActiveProject.PropertyTypeLibrary;
// Create an integer property type in the Property Types library and set:
// - Name to MyPlugin.MyIntProperty
// Use the name of your plugin as the property type namespace to avoid naming conflicts
// with other property types in the Kanzi Studio project that use the project name as
// the default property type namespace.
// - Name as it is shown in Kanzi Studio to My Int Property
// - Category in which Kanzi Studio shows the property type to My Plugin Properties
// - Lowest value to 0
// - Highest value to 9000
// - The amount by which the property can change to 10
var myIntProperty = propertyTypesLibrary.CreateIntProperty(
propertyTypesLibrary.GenerateUniqueChildName("MyPlugin.MyIntProperty"),
"My Int Property",
"My Plugin Properties",
0,
9000,
10);
}
Property CreateProperty ( Type  dataType,
string  name,
string  displayName,
string  category 
)

Creates a property type of data type you specify.

The property type you create with this function uses the default values for each new property type. For example, when you create a property type of integer data type, the values for the Lower Bound, Upper Bound, and Step are not defined. Note that to create some property types you need to include the correct using directive. For example, to create a property type of the vector 2D data type you need to include the System.Windows using directive.

Parameters
dataTypeThe data type of the property type.
nameThe name of the property that you use with the Kanzi Engine API. The name must be unique among the property types and must not contain spaces.
displayNameThe name of the property as it is shown in Kanzi Studio.
categoryThe category in which Kanzi Studio shows this property type.
Returns
The property type of data type you create.
See also
ProjectItem.PropertyTypeLibrary, CreateProperty<T>(string, string, string), CreateIntProperty, CreateFloatProperty, CreateVector3DProperty

Examples

To create property types of different data types:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library in the project.
var propertyTypesLibrary = studio.ActiveProject.PropertyTypeLibrary;
// Define a string that consists of the name of your plugin followed by a dot.
// To create a property type to a property namespace named after your plugin,
// prefix this string to the name of the property type.
string pluginNamespace = "MyPlugin.";
// Create a boolean property type and set:
// - Name to MyPlugin.BooleanPropertyType
// - Name as it is shown in Kanzi Studio to Boolean Property Type
// - Category in which Kanzi Studio shows the property type to My Plugin Properties
propertyTypesLibrary.CreateProperty(
typeof(bool),
propertyTypesLibrary.GenerateUniqueChildName(pluginNamespace + "BooleanPropertyType"),
"Boolean Property Type",
"My Plugin Properties");
// Create a float property type with these property values:
// - Name to MyPlugin.FloatPropertyType
// - Name as it is shown in Kanzi Studio to Float Property Type
// - Category in which Kanzi Studio shows the property type to My Plugin Properties
propertyTypesLibrary.CreateProperty(
typeof(float),
propertyTypesLibrary.GenerateUniqueChildName(pluginNamespace + "FloatPropertyType"),
"Float Property Type",
"My Plugin Properties");
// Create an integer property type with these property values:
// - Name to MyPlugin.IntegerPropertyType
// - Name as it is shown in Kanzi Studio to Integer Property Type
// - Category in which Kanzi Studio shows the property type to My Plugin Properties
propertyTypesLibrary.CreateProperty(
typeof(int),
propertyTypesLibrary.GenerateUniqueChildName(pluginNamespace + "IntegerPropertyType"),
"Integer Property Type",
"My Plugin Properties");
// Create a string property type with these property values:
// - Name to MyPlugin.StringPropertyType
// - Name as it is shown in Kanzi Studio to String Property Type
// - Category in which Kanzi Studio shows the property type to My Plugin Properties
propertyTypesLibrary.CreateProperty(
typeof(string),
propertyTypesLibrary.GenerateUniqueChildName(pluginNamespace + "StringPropertyType"),
"String Property Type",
"My Plugin Properties");
// Create a vector 2D property type with these property values:
// - Name to MyPlugin.Vector2DPropertyType
// - Name as it is shown in Kanzi Studio to Vector 2D Property Type
// - Category in which Kanzi Studio shows the property type to My Plugin Properties
propertyTypesLibrary.CreateProperty(
typeof(System.Windows.Vector),
propertyTypesLibrary.GenerateUniqueChildName(pluginNamespace + "Vector2DPropertyType"),
"Vector 2D Property Type",
"My Plugin Properties");
}
TypedProperty<T> CreateProperty< T > ( string  name,
string  displayName,
string  category 
)

Creates a property type of data type you specify.

The property type you create with this function uses the default values for each new property type. For example, when you create a property type of integer data type, the values for the Lower Bound, Upper Bound, and Step are not defined. Note that to create some property types you need to include the correct using directive. For example, to create a property type of the vector 2D data type you need to include the System.Windows using directive.

Template Parameters
TThe data type of the property type.
Parameters
nameThe name of the property that you use with the Kanzi Engine API. The name must be unique among the property types and must not contain spaces.
displayNameThe name of the property as it is shown in Kanzi Studio.
categoryThe category in which Kanzi Studio shows this property type.
Returns
The property type of data type you create.
See also
ProjectItem.PropertyTypeLibrary, CreateProperty, CreateIntProperty, CreateFloatProperty, CreateVector3DProperty

Examples

To create a property types of different data types:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library in the project.
var propertyTypesLibrary = studio.ActiveProject.PropertyTypeLibrary;
// Define a string that consists of the name of your plugin followed by a dot.
// To create a property type to a property namespace named after your plugin,
// prefix this string to the name of the property type.
string pluginNamespace = "MyPlugin.";
// Create a Boolean property type named Boolean property type in My Plugin Properties category.
propertyTypesLibrary.CreateProperty<bool>(
propertyTypesLibrary.GenerateUniqueChildName(pluginNamespace + "BooleanPropertyType"),
"Boolean property type",
"My Plugin Properties");
// Create a float property type named Float property type in My Plugin Properties category.
propertyTypesLibrary.CreateProperty<float>(
propertyTypesLibrary.GenerateUniqueChildName(pluginNamespace + "FloatPropertyType"),
"Float property type",
"My Plugin Properties");
// Create an integer property type named Integer property type in My Plugin Properties category.
propertyTypesLibrary.CreateProperty<int>(
propertyTypesLibrary.GenerateUniqueChildName(pluginNamespace + "IntegerPropertyType"),
"Integer property type",
"My Plugin Properties");
// Create a string property type named String property type in My Plugin Properties category.
propertyTypesLibrary.CreateProperty<string>(
propertyTypesLibrary.GenerateUniqueChildName(pluginNamespace + "StringPropertyType"),
"String property type",
"My Plugin Properties");
// Create a vector 2D property type named Vector 2D property type in My Plugin Properties category.
propertyTypesLibrary.CreateProperty<System.Windows.Vector>(
propertyTypesLibrary.GenerateUniqueChildName(pluginNamespace + "Vector2DPropertyType"),
"Vector 2D property type",
"My Plugin Properties");
}
Vector2DProperty CreateVector2DProperty ( string  name,
string  displayName,
string  category,
Vector?  lowerBound,
Vector?  upperBound,
Vector?  step 
)

Creates a property type of the vector 2D data type.

Note that to create a vector 2D data type you need to add the using directive for the System.Windows.

Parameters
nameThe name of the property that you use with the Kanzi Engine API. The name must be unique among the property types and must not contain spaces.
displayNameThe name of the property as it is shown in Kanzi Studio.
categoryThe category in which Kanzi Studio shows this property type.
lowerBoundThe lower value limit of the property. Set as null to use the default value of the data type.
upperBoundThe upper value limit of the property. Set as null to use the default value of the data type.
stepThe minimum amount by which the value of the property can change. Use null to set the default value.
Returns
The property type of the Vector2D data type.
See also
ProjectItem.PropertyTypeLibrary

Examples

To create a property type of the Vector2D data type:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library in the project.
var propertyTypesLibrary = studio.ActiveProject.PropertyTypeLibrary;
// Create variables for the parameters which set the lowest and highest possible values,
// and the minimum amount by which the value of the property can change.
Vector lowerBoundaries = new Vector(0, 0);
Vector upperBoundaries = new Vector(100, 100);
Vector step = new Vector(1, 1);
// Create a Vector2D property type in the Property Types library and set:
// - Name to MyPlugin.MyVector2DProperty
// Use the name of your plugin as the property type namespace to avoid naming conflicts
// with other property types in the Kanzi Studio project that use the project name as
// the default property type namespace.
// - Name as it is shown in Kanzi Studio to My Vector2D Property
// - Category in which Kanzi Studio shows the property type to My Plugin Properties
// - Lowest value to 0, 0
// - Highest value to 100, 100
// - The amount by which each field in the property can change to 1
var myVector2DProperty = propertyTypesLibrary.CreateVector2DProperty(
propertyTypesLibrary.GenerateUniqueChildName("MyPlugin.MyVector2DProperty"),
"My Vector2D Property",
"My Plugin Properties",
lowerBoundaries,
upperBoundaries,
step);
}
Vector3DProperty CreateVector3DProperty ( string  name,
string  displayName,
string  category,
Vector3D?  lowerBound,
Vector3D?  upperBound,
Vector3D?  step 
)

Creates a property type of the vector 3D data type.

Note that to create a vector 3D data type you need to add the using directive for the System.Windows.Media.Media3D.

Parameters
nameThe name of the property that you use with the Kanzi Engine API. The name must be unique among the property types and must not contain spaces.
displayNameThe name of the property as it is shown in Kanzi Studio.
categoryThe category in which Kanzi Studio shows this property type.
lowerBoundThe lower value limit of the property. Set as null to use the default value of the data type.
upperBoundThe upper value limit of the property. Set as null to use the default value of the data type.
stepThe minimum amount by which the value of the property can change. Use null to set the default value.
Returns
The property type of the Vector3D data type.
See also
ProjectItem.PropertyTypeLibrary

Examples

To create a property type of the Vector3D data type:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library in the project.
var propertyTypesLibrary = studio.ActiveProject.PropertyTypeLibrary;
// Create variables for the parameters which set the lowest and highest possible values,
// and the minimum amount by which the value of the property can change.
Vector3D lowerBoundaries = new Vector3D(0, 0, 0);
Vector3D upperBoundaries = new Vector3D(10, 10, 10);
Vector3D step = new Vector3D(1, 1, 1);
// Create a Vector3D property type in the Property Types library and set:
// - Name to MyPlugin.MyVector3DProperty
// Use the name of your plugin as the property type namespace to avoid naming conflicts
// with other property types in the Kanzi Studio project that use the project name as
// the default property type namespace.
// - Name as it is shown in Kanzi Studio to My Vector3D Property
// - Category in which Kanzi Studio shows the property type to My Plugin Properties
// - Lowest value to 0, 0, 0
// - Highest value to 10, 10, 10
// - The amount by which each field in the property can change to 1
var myVector3DProperty = propertyTypesLibrary.CreateVector3DProperty(
propertyTypesLibrary.GenerateUniqueChildName("MyPlugin.MyVector3DProperty"),
"My Vector3D Property",
"My Plugin Properties",
lowerBoundaries,
upperBoundaries,
step);
}
void DeleteProperty ( Property  property)

Deletes a property type from the Property Types library.

Default nor plugin provided property types cannot be deleted.

Parameters
propertyThe property type you want to delete.
See also
ProjectItem.PropertyTypeLibrary

Examples

To delete a property type:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library in the project.
var propertyTypesLibrary = studio.ActiveProject.PropertyTypeLibrary;
// Get all property types stored in the Property Types library and delete them.
foreach (Property property in propertyTypesLibrary.ProjectPropertyTypes.ToList())
{
propertyTypesLibrary.DeleteProperty(property);
}
}
IEnumerable<PropertyEditor> GetCompatiblePropertyEditors ( Property  property)

Gets the property editors that Kanzi Studio can use to set the value of a property.

Parameters
propertyThe property.
Returns
List of the property editors that Kanzi Studio can use to set the value of the property.
Property GetProperty ( string  name)

Gets the property with given name either from ProjectPropertyTypes for DefaultPropertyTypes.

Parameters
nameName of the property.

Property Documentation

IEnumerable<Property> DefaultPropertyTypes
get

Gets the default Kanzi property types.

Lists also the property types provided by Kanzi Engine plugins.

Examples

To get all default Kanzi property types:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library.
var propertyTypesLibrary = studio.ActiveProject.PropertyTypeLibrary;
// Get all default Kanzi property types.
foreach (Property property in propertyTypesLibrary.DefaultPropertyTypes)
{
// Print the names of all default property types to the Kanzi Studio Log window.
studio.Log(property.Name);
}
}
IEnumerable<Property> ProjectPropertyTypes
get

Gets the property types stored in the Property Types 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;
// Get all property types stored in the Property Types library.
foreach (Property property in propertyTypesLibrary.ProjectPropertyTypes)
{
// Print the names of all property types stored in the Property Types library to the Kanzi Studio Log window.
studio.Log(property.Name);
}
}