Properties | List of all members
Binding Interface Reference

Configure binding arguments. More...

Inheritance diagram for Binding:

Properties

string Code [get, set]
 Gets or sets the binding expression. More...
 
bool IsCodeValid [get]
 Checks whether the binding expression is valid. More...
 
Property Property [get]
 Gets the property the binding binds. More...
 
AnimationTargetPropertyAttributeEnum PropertyAttribute [get, set]
 Gets or sets the property attribute the binding binds. More...
 

Detailed Description

Configure binding arguments.

See also
BindingHost

Property Documentation

string Code
getset

Gets or sets the binding expression.

Examples

To set the binding expression of a binding:

// This example creates a node, adds a binding to it, and then changes the binding expression.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.Project.GetProjectItem("Screens/Screen/RootPage");
// Create a Text Block 2D node in the RootPage node.
var textBlock = studio.Project.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");
// Set the binding expression to 5 so that the binding now binds the scale of the Text Block 2D node on the x axis
// to the location of the node on the y axis.
binding.Code = "{@./LayoutTransformation}.TranslationY";
}
bool IsCodeValid
get

Checks whether the binding expression is valid.

Examples

To check whether a binding expression is valid:

// This example creates a node, adds a binding to it, and checks if the binding expression is valid.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.Project.GetProjectItem("Screens/Screen/RootPage");
// Create a Text Block 2D node in the RootPage node.
var textBlock = studio.Project.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, "@./LayoutTransformation}.TranslationY");
// If the binding expression has an error, print a notification to the Kanzi Studio Log window.
if (!binding.IsCodeValid)
{
studio.Log("Invalid binding expression " + binding.Code + " in the " + textBlock.Name + " node");
}
}
Property Property
get

Gets the property the binding binds.

Examples

To get the property a binding binds:

// This example creates a node, adds a binding to it, and prints the name of the binding property.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.Project.GetProjectItem("Screens/Screen/RootPage");
// Create a Text Block 2D node in the RootPage node.
var textBlock = studio.Project.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");
// Print the name of the binding property to the Kanzi Studio Log window.
studio.Log("Binding Property: " + binding.Property.Name);
}
AnimationTargetPropertyAttributeEnum PropertyAttribute
getset

Gets or sets the property attribute the binding binds.

Examples

To set the property attribute a binding binds:

// This example creates a node, adds a binding to it, and then changes the binding property attribute.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.Project.GetProjectItem("Screens/Screen/RootPage");
// Create a Text Block 2D node in the RootPage node.
var textBlock = studio.Project.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");
// Set the property attribute to Scale Y so that the binding now binds the scale of the Text Block 2D node
// on the y axis to the constant value 10.
binding.PropertyAttribute = AnimationTargetPropertyAttributeEnum.SCALE_Y;
}