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

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< PropertyEditor > GetCompatiblePropertyEditors (Property property)
 
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< Property > DefaultPropertyTypes [get]
 Gets the default Kanzi property types. More...
 
IEnumerable< Property > ProjectPropertyTypes [get]
 Gets the property types stored in the Property Types library. More...
 
IEnumerable< PropertyEditor > PropertyEditors [get]
 

Detailed Description

Stores property types declared in the current Kanzi Studio project.

Factory for creating new property types.

Member Function Documentation

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
Project.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.Project.PropertyTypeLibrary;
// Get the Property Namespace property of the project and append a dot to it.
// You add this string as a prefix to the name of the property type you create.
// This way you create the property type to the project property namespace.
var projectPropertyNamespace = studio.Project.Get(Properties.PropertyNamespace) + ".";
// Create a float property type in the Property Types library and set:
// - Name to <ProjectPropertyNamespace>.MyFloatProperty
// - Name as it is shown in Kanzi Studio to My Float Property
// - Category in which Kanzi Studio shows the property type to My Properties
// - Lowest value to 0.0
// - Highest value to 100.0
// - The amount by which the property can change to 0.1
var myFloatProperty = studio.Project.PropertyTypeLibrary.CreateFloatProperty(
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "MyFloatProperty"),
"My Float Property",
"My 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
Project.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.Project.PropertyTypeLibrary;
// Get the Property Namespace property of the project and append a dot to it.
// You add this string as a prefix to the name of the property type you create.
// This way you create the property type to the project property namespace.
var projectPropertyNamespace = studio.Project.Get(Properties.PropertyNamespace) + ".";
// Create an integer property type in the Property Types library and set:
// - Name to <ProjectPropertyNamespace>.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.Project.PropertyTypeLibrary.CreateIntProperty(
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "MyIntProperty"),
"My Int Property",
"My 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
Project.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.Project.PropertyTypeLibrary;
// Get the Property Namespace property of the project and append a dot to it.
// You add this string as a prefix to the names of the property types you create.
// This way you create the property types to the project property namespace.
var projectPropertyNamespace = studio.Project.Get(Properties.PropertyNamespace) + ".";
// Create a boolean property type and set:
// - Name to <ProjectPropertyNamespace>.BooleanPropertyType
// - Name as it is shown in Kanzi Studio to Boolean Property Type
// - Category in which Kanzi Studio shows the property type to My properties
studio.Project.PropertyTypeLibrary.CreateProperty(
typeof(bool),
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "BooleanPropertyType"),
"Boolean Property Type",
"My properties");
// Create a float property type with these property values:
// - Name to <ProjectPropertyNamespace>.FloatPropertyType
// - Name as it is shown in Kanzi Studio to Float Property Type
// - Category in which Kanzi Studio shows the property type to My properties
studio.Project.PropertyTypeLibrary.CreateProperty(
typeof(float),
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "FloatPropertyType"),
"Float Property Type",
"My properties");
// Create an integer property type with these property values:
// - Name to <ProjectPropertyNamespace>.IntegerPropertyType
// - Name as it is shown in Kanzi Studio to Integer Property Type
// - Category in which Kanzi Studio shows the property type to My properties
studio.Project.PropertyTypeLibrary.CreateProperty(
typeof(int),
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "IntegerPropertyType"),
"Integer Property Type",
"My properties");
// Create a string property type with these property values:
// - Name to <ProjectPropertyNamespace>.StringPropertyType
// - Name as it is shown in Kanzi Studio to String Property Type
// - Category in which Kanzi Studio shows the property type to My properties
studio.Project.PropertyTypeLibrary.CreateProperty(
typeof(string),
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "StringPropertyType"),
"String Property Type",
"My properties");
// Create a vector 2D property type with these property values:
// - Name to <ProjectPropertyNamespace>.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 properties
studio.Project.PropertyTypeLibrary.CreateProperty(
typeof(System.Windows.Vector),
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "Vector2DPropertyType"),
"Vector 2D Property Type",
"My 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
Project.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.Project.PropertyTypeLibrary;
// Get the Property Namespace property of the project and append a dot to it.
// You add this string as a prefix to the names of the property types you create.
// This way you create the property types to the project property namespace.
var projectPropertyNamespace = studio.Project.Get(Properties.PropertyNamespace) + ".";
// Create a Boolean property type named Boolean property type in My properties category.
studio.Project.PropertyTypeLibrary.CreateProperty<bool>(
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "BooleanPropertyType"),
"Boolean property type",
"My properties");
// Create a float property type named Float property type in My properties category.
studio.Project.PropertyTypeLibrary.CreateProperty<float>(
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "FloatPropertyType"),
"Float property type",
"My properties");
// Create an integer property type named Integer property type in My properties category.
studio.Project.PropertyTypeLibrary.CreateProperty<int>(
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "IntegerPropertyType"),
"Integer property type",
"My properties");
// Create a string property type named String property type in My properties category.
studio.Project.PropertyTypeLibrary.CreateProperty<string>(
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "StringPropertyType"),
"String property type",
"My properties");
// Create a vector 2D property type named Vector 2D property type in My properties category.
studio.Project.PropertyTypeLibrary.CreateProperty<System.Windows.Vector>(
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "Vector2DPropertyType"),
"Vector 2D property type",
"My 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 Vevtor2D data type.
See also
Project.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.Project.PropertyTypeLibrary;
// Get the Property Namespace property of the project and append a dot to it.
// You add this string as a prefix to the name of the property type you create.
// This way you create the property type to the project property namespace.
var projectPropertyNamespace = studio.Project.Get(Properties.PropertyNamespace) + ".";
// 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 lowerBoundries = new Vector(0, 0);
Vector upperBoundries = new Vector(100, 100);
Vector step = new Vector(1, 1);
// Create a Vector2D property type in the Property Types library and set:
// - Name to <ProjectPropertyNamespace>.MyVector2DProperty
// - Name as it is shown in Kanzi Studio to My Vector2D Property
// - Category in which Kanzi Studio shows the property type to My 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 = studio.Project.PropertyTypeLibrary.CreateVector2DProperty(
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "MyVector2DProperty"),
"My Vector2D Property",
"My Properties",
lowerBoundries,
upperBoundries,
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 Vevtor3D data type.
See also
Project.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.Project.PropertyTypeLibrary;
// Get the Property Namespace property of the project and append a dot to it.
// You add this string as a prefix to the name of the property type you create.
// This way you create the property type to the project property namespace.
var projectPropertyNamespace = studio.Project.Get(Properties.PropertyNamespace) + ".";
// 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 lowerBoundry = new Vector3D(0, 0, 0);
Vector3D upperBoundry = 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 <ProjectPropertyNamespace>.MyVector3DProperty
// - Name as it is shown in Kanzi Studio to My Vector3D Property
// - Category in which Kanzi Studio shows the property type to My 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 = studio.Project.PropertyTypeLibrary.CreateVector3DProperty(
propertyTypesLibrary.GenerateUniqueChildName(projectPropertyNamespace + "MyVector3DProperty"),
"My Vector3D Property",
"My Properties",
lowerBoundry,
upperBoundry,
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
Project.PropertyTypeLibrary

Examples

To delete a property type:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library in the project.
var propertyTypesLibrary = studio.Project.PropertyTypeLibrary;
// Get all property types stored in the Property Types library and delete them.
foreach (Property property in propertyTypesLibrary.ProjectPropertyTypes.ToList())
{
studio.Project.PropertyTypeLibrary.DeleteProperty(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.

The default Kanzi property types.

Examples

To get all default Kanzi property types:

public void Execute(PluginCommandParameter parameter)
{
// Get the Property Types library.
var propertyTypesLibrary = studio.Project.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.

The property types 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.Project.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);
}
}