Kanzi 3.9.16
BindingHost Interface Reference

Configure bindings. More...

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

Public Member Functions

Binding CreateBinding (Binding sourceBinding)
 Creates a binding by copying an existing binding.
 
Binding CreateBinding (Property property, AnimationTargetPropertyAttributeEnum attribute, string code, BindingTypeEnum bindingMode, NodeReferenceBase pushTarget)
 Creates and configures a binding.
 
Binding CreateBinding (Property property, AnimationTargetPropertyAttributeEnum attribute, string code, BindingTypeEnum bindingMode=BindingTypeEnum.ONE_WAY)
 Creates and configures a One Way binding.
 
void DeleteBinding (Binding binding)
 Deletes a binding.
 
- Public Member Functions inherited from ProjectItem
void AddProperty (Property property)
 Adds a property to an item.
 
void AddProperty (string propertyName)
 Adds a property to an item.
 
void BeginBatchModification (string batchName)
 
bool CanAddProperty (Property property)
 Checks whether Kanzi Studio allows you to add a specific property to an item.
 
bool CanAddProperty (string propertyName)
 Checks whether Kanzi Studio allows you to add a specific property to an item.
 
void CommitBatchModification ()
 
bool Delete ()
 Deletes a project item.
 
void DeregisterThumbnailUser (object user)
 Deregisters a registerd thumbnail user.
 
IEnumerable< Property > GetAddableProperties ()
 Gets a list of properties which you can add to an item.
 
T GetAncestor< T > ()
 Gets the nearest item of given type in the parent tree.
 
ProjectItem GetChild (string childName)
 Gets the child item of the current item with the given name.
 
T GetChild< T > (string childName)
 Gets the child item of the current item with the given name and type.
 
int GetChildIndex (ProjectItem child)
 
IEnumerable< Property > GetContextProperties ()
 
IEnumerable< Property > GetFixedProperties ()
 
IEnumerable< Property > GetFrequentlyAddedProperties ()
 
ProjectItem GetProjectItemByPath (string path)
 
string GetRelativeProjectPathTo (ProjectItem anotherItem)
 
IEnumerable< Property > GetRemovableProperties ()
 Gets a list of properties which you can remove from an item.
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode)
 Gets the thumbnail image for a project item.
 
BitmapSource GetThumbnail (int width, int height, bool showChildren, bool showFullScreen, Node contextNode, float[] letterboxColorRGBA)
 Gets the thumbnail image for a project item.
 
IEnumerable< ProjectItem > GetTreeItemsAsList ()
 Enumerates the items under this ProjectItem including this item itself, children, and grand children.
 
bool HasProperty (Property property)
 Checks whether an item has a specific property.
 
bool HasProperty (string propertyName)
 Checks whether an item has a specific property.
 
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.
 
void RemoveProperty (Property property)
 Removes a property from an item.
 
void RemoveProperty (string propertyName)
 Removes a property from an item.
 
void SetChildIndex (ProjectItem child, int index)
 
void SetPropertyReadOnlyStatus (Property property, bool? value)
 
void UpdateValidity ()
 Recalculates the validity the item.
 
- Public Member Functions inherited from PropertyContainer
object Get (Property property)
 Gets the value of a property.
 
object Get (string propertyName)
 Gets the value of a property.
 
T Get< T > (TypedProperty< T > property)
 Gets the value of a property.
 
void Set (string propertyName, object value)
 Sets the value of a property.
 
void Set< T > (TypedProperty< T > property, T value)
 Sets the value of a property.
 
- Public Member Functions inherited from ChildContainer
string GenerateUniqueChildName (string defaultName)
 Generates a unique name.
 
string GetInvalidityReasonOfNewName (string newName)
 Returns the reason why the passed name is not valid.
 

Properties

IEnumerable< Binding > Bindings [get]
 Gets the bindings in a BindingHost.
 
- Properties inherited from ProjectItem
IEnumerable< ProjectItem > Children [get]
 Gets all child items of a project item.
 
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.
 
string Name [get, set]
 Gets or sets the name of a project item.
 
ProjectItem Parent [get, set]
 
string Path [get]
 
Project Project [get]
 Gets the project in which this item is located.
 
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.
 
ProjectItemProperties PropertyTypes [get]
 
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.
 
- Properties inherited from PropertyContainer
IEnumerable< Property > Properties [get]
 Gets the properties in a project item or node component.
 

Additional Inherited Members

- Events inherited from ProjectItem
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

Configure bindings.

This class represents a binding host which can have bindings.

Use bindings to update properties or property attributes of one node with the properties or property attributes of other nodes. Bindings allow nodes to automatically update the values of their properties in response to the changing attributes in other nodes or the occurrence of some external event.

See also
Binding

Member Function Documentation

◆ CreateBinding() [1/3]

Binding CreateBinding ( Binding sourceBinding)

Creates a binding by copying an existing binding.

Parameters
sourceBindingThe binding you want to copy to create a new binding.
Returns
The binding you create with this function.

Examples

To create a binding from an existing binding:

// This example creates a Text Block 2D node and binds the scale of the node on the x axis to the value 10.
// It then creates another Text Block 2D node and copies the binding to that node.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Text Block 2D node in the RootPage node.
var textBlock = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
// Create a binding which binds the scale of the Text Block 2D node on the x axis to the constant value 10.
var binding = textBlock.CreateBinding(Properties.Node2DLayoutTransformation, AnimationTargetPropertyAttributeEnum.SCALE_X, "10");
// Create another Text Block 2D node in the RootPage node.
var textBlock2 = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
// Create a binding for the second Text Block 2D node by copying the binding in the first Text Block 2D node.
textBlock2.CreateBinding(binding);
}

◆ CreateBinding() [2/3]

Binding CreateBinding ( Property property,
AnimationTargetPropertyAttributeEnum attribute,
string code,
BindingTypeEnum bindingMode,
NodeReferenceBase pushTarget )

Creates and configures a binding.

Parameters
propertyThe property that you want to bind.
attributeThe property field that you want to bind.
codeThe binding expression.
bindingModeThe binding mode.
pushTargetThe push target node for To Source binding.
Returns
The binding you create with this function.
See also
Binding

Examples

To create a binding:

// This example creates a Box node and a Text Box 2D node. The example then binds the text in the Text Box node to the
// Box node Render Transformation property Translation X property field.
public void Execute(PluginCommandParameter parameter)
{
// Get the component type library which contains the Kanzi component node types.
var componentTypeLibrary = studio.ActiveProject.ComponentTypeLibrary;
// Get the Screens/Screen/RootPage/Viewport 2D/Scene node.
var scene = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D/Scene");
// Create a Box node named Box in the Scene node.
studio.ActiveProject.CreateProjectItem<BoxMeshNode>(scene.GenerateUniqueChildName("Box"), scene);
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen").GetChild<Page>("RootPage");
// Create a Text Box 2D node in the RootPage node.
var textBox = studio.ActiveProject.CreateComponentNode(rootPage.GenerateUniqueChildName("Text Box 2D"), rootPage, componentTypeLibrary.GetComponentType(ComponentTypeNames.TextBox2D));
// Create a To Source binding that sets the Box node Render Transformation property Translation X property field based on the text in the Text Box node.
textBox.CreateBinding(
Properties.Node3DRenderTransformation,
"INT({@./TextConcept.Text})",
BindingTypeEnum.TO_SOURCE,
new NodeReference<BoxMeshNode>("relative://../Viewport 2D/Scene/Box"));
}

◆ CreateBinding() [3/3]

Binding CreateBinding ( Property property,
AnimationTargetPropertyAttributeEnum attribute,
string code,
BindingTypeEnum bindingMode = BindingTypeEnum.ONE_WAY )

Creates and configures a One Way binding.

Parameters
propertyThe property that you want to bind.
attributeThe property field that you want to bind.
codeThe binding expression.
bindingModeThe binding mode.
Returns
The binding you create with this function.
See also
Binding

Examples

To create a binding:

// This example creates a Box node and binds the scale of the node on the y axis
// to the location of the node along the x axis multiplied by 5.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage/Viewport 2D/Scene node.
var scene = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D/Scene");
// Create a Box node named Box in the Scene node.
var box = studio.ActiveProject.CreateProjectItem<BoxMeshNode>(scene.GenerateUniqueChildName("Box"), scene);
// Create a binding which binds the scale of the Box node on the y axis to
// the location of the Box node along the x axis and multiplies it by 5.
box.CreateBinding(Properties.Node3DLayoutTransformation, AnimationTargetPropertyAttributeEnum.SCALE_Y, "{@./LayoutTransformation}.TranslationX*5");
}

◆ DeleteBinding()

void DeleteBinding ( Binding binding)

Deletes a binding.

Parameters
bindingThe binding you want to delete.

Examples

To delete a binding:

// This example creates a Text Block 2D node and binds the scale of the node on the x axis to the value 10.
// It then creates another Text Block 2D node, copies the binding to that node, and deletes the binding from
// the first Text Block 2D node.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Text Block 2D node in the RootPage node.
var textBlock = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
// Create a binding which binds the scale of the Text Block 2D node on the x axis to the constant value 10.
var binding = textBlock.CreateBinding(Properties.Node2DLayoutTransformation, AnimationTargetPropertyAttributeEnum.SCALE_X, "10");
// Create another Text Block 2D node in the RootPage node.
var textBlock2 = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
// Create a binding for the second Text Block 2D node by copying the binding in the first Text Block 2D node.
textBlock2.CreateBinding(binding);
// Delete the binding from the first Text Block 2D node.
textBlock.DeleteBinding(binding);
}

Property Documentation

◆ Bindings

IEnumerable<Binding> Bindings
get

Gets the bindings in a BindingHost.

Examples

To get the bindings in a node:

// This example creates a Text Block 2D node, adds two bindings to it, and modifies the second binding.
// It then prints the property, property attribute, and binding expression of both bindings to the Kanzi Studio Log window.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Text Block 2D node in the RootPage node.
var textBlock = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
// Create a binding which binds the scale of the Text Block 2D node on the x axis to the constant value 10.
var binding1 = textBlock.CreateBinding(Properties.Node2DLayoutTransformation, AnimationTargetPropertyAttributeEnum.SCALE_X, "10");
// Create a binding for the second Text Block 2D node by copying the binding in the first Text Block 2D node.
var binding2 = textBlock.CreateBinding(binding1);
// Set the property attribute of the binding in the second Text Block 2D node so that the binding binds
// the scale of the Text Block 2D node on the y axis to the constant value 10.
binding2.PropertyAttribute = AnimationTargetPropertyAttributeEnum.SCALE_Y;
// Print the property, property attribute, and binding expression of each binding in the Text Block 2D node
// to the Kanzi Studio Log window.
studio.Log("Bindings in the " + textBlock.Name + " node:");
foreach (var binding in textBlock.Bindings)
{
studio.Log(binding.Property.Name + " " + binding.PropertyAttribute + ": " + binding.Code);
}
}