Configure binding arguments.
More...
Configure binding arguments.
- See also
- BindingHost
◆ Code
Gets or sets the binding expression.
Examples
To set the binding expression of a binding:
public void Execute(PluginCommandParameter parameter)
{
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
var textBlock = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
var binding = textBlock.CreateBinding(Properties.Node2DLayoutTransformation, AnimationTargetPropertyAttributeEnum.SCALE_X, "10");
binding.Code = "{@./LayoutTransformation}.TranslationY";
}
◆ IsBindingActive
Checks whether the binding is active.
Examples
To check whether a binding is active:
public void Execute(PluginCommandParameter parameter)
{
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
var textBlock = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
var binding = textBlock.CreateBinding(
Properties.Node2DLayoutTransformation,
AnimationTargetPropertyAttributeEnum.SCALE_X,
"@./LayoutTransformation}.TranslationY");
if (binding.IsBindingActive)
{
studio.Log("Binding is inactive in the " + textBlock.Name + " node");
}
}
◆ IsBindingEnabled
Gets or sets a value indicating whether this binding is enabled
Examples
To make the binding disabled:
public void Execute(PluginCommandParameter parameter)
{
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
var textBlock = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
var binding = textBlock.CreateBinding(
Properties.Node2DLayoutTransformation, AnimationTargetPropertyAttributeEnum.SCALE_X, "@./LayoutTransformation}.TranslationY");
binding.IsBindingEnabled = false;
if (!binding.IsBindingEnabled)
{
studio.Log("Binding is enabled in the " + textBlock.Name + " node");
}
}
◆ IsCodeValid
Checks whether the binding expression is valid.
Examples
To check whether a binding expression is valid:
public void Execute(PluginCommandParameter parameter)
{
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
var textBlock = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
var binding = textBlock.CreateBinding(
Properties.Node2DLayoutTransformation, AnimationTargetPropertyAttributeEnum.SCALE_X, "@./LayoutTransformation}.TranslationY");
if (!binding.IsCodeValid)
{
studio.Log("Invalid binding expression " + binding.Code + " in the " + textBlock.Name + " node");
}
}
◆ Property
Gets the property the binding binds.
Examples
To get the property a binding binds:
public void Execute(PluginCommandParameter parameter)
{
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
var textBlock = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
var binding = textBlock.CreateBinding(Properties.Node2DLayoutTransformation, AnimationTargetPropertyAttributeEnum.SCALE_X, "10");
studio.Log("Binding Property: " + binding.Property.Name);
}
◆ PropertyAttribute
AnimationTargetPropertyAttributeEnum PropertyAttribute |
|
getset |
Gets or sets the property field that the binding binds.
Examples
To set the property field that a binding binds:
public void Execute(PluginCommandParameter parameter)
{
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
var textBlock = studio.ActiveProject.CreateProjectItem<TextBlock2D>(rootPage.GenerateUniqueChildName("Text Block 2D"), rootPage);
var binding = textBlock.CreateBinding(Properties.Node2DLayoutTransformation, AnimationTargetPropertyAttributeEnum.SCALE_X, "10");
binding.PropertyAttribute = AnimationTargetPropertyAttributeEnum.SCALE_Y;
}