Kanzi 3.9.16
TriggerNodeComponent Interface Reference

Configure triggers. More...

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

Public Member Functions

TriggerActionItem CreateAction ([NotNull] TriggerActionType actionType)
 Creates a trigger action.
 
TriggerConditionItem CreateCondition ()
 Creates a trigger condition.
 
TriggerConditionItem CreateCondition ([NotNull] TriggerConditionItem toClone)
 Creates a trigger condition by cloning an existing trigger condition.
 
bool DeleteAction ([NotNull] TriggerActionItem action)
 Deletes a trigger action.
 
bool DeleteCondition ([NotNull] TriggerConditionItem condition)
 Deletes a trigger condition.
 
- 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.
 
- Public Member Functions inherited from BindingHost
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.
 

Properties

IEnumerable< TriggerActionItem > Actions [get]
 Gets the actions in a trigger.
 
IEnumerable< TriggerConditionItem > Conditions [get]
 Gets the conditions in a trigger.
 
bool IsMessageTrigger [get]
 Gets whether the trigger is a message trigger.
 
Node MessageSource [get, set]
 Gets or sets the target item from which to intercept messages.
 
new TriggerNodeComponentProperties PropertyTypes [get]
 
NodeReference< Node > RelativeMessageSource [get, set]
 
MessageRoutingModeEnum RoutingMode [get, set]
 Gets or sets the message routing mode:
 
bool SetHandled [get, set]
 Gets or sets the message handling mode:
 
MessageType TriggerMessageType [get]
 Gets the Trigger Message Type.
 
- Properties inherited from NodeComponent
NodeComponentType NodeComponentType [get]
 
- 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.
 
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.
 
- Properties inherited from BindingHost
IEnumerable< Binding > Bindings [get]
 Gets the bindings in a BindingHost.
 

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 triggers.

You can use this interface to:

  • Configure trigger settings. You can set the message handling, routing mode, and message source of a trigger.
  • Create and delete trigger actions. An action is an outcome of a trigger. Kanzi has general actions, such as Set Property and Write Log, and message actions, that you can use to control a specific type of item, such as Go To State, or Navigate To Page.
  • Create and delete trigger conditions. Trigger conditions enable you to set which conditions must be met for the trigger to set off.
See also
NodeComponentHost, TriggerActionItem, TriggerConditionItem

Member Function Documentation

◆ CreateAction()

TriggerActionItem CreateAction ( [NotNull] TriggerActionType actionType)

Creates a trigger action.

Parameters
actionType
Returns
The trigger action.
See also
TriggerActionItem

Examples

To create a Write Log action:

public void Execute(PluginCommandParameter parameter)
{
// Create a Button 2D node named Click in the RootPage node.
var buttonClick = studio.ActiveProject.CreateProjectItem<Button2D>(
"Click",
studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage"));
// Get the first Button: Click trigger in the Click button.
var clickTrigger = buttonClick.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create a Write Log action in the Button: Click trigger.
var writeLogAction = clickTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.WriteLogAction"));
// In the Write Log action set Log Text to "Button clicked".
writeLogAction.Set(Properties.WriteLogActionLogText, "Button clicked");
}

To create a Set Property action:

// This example creates a button with a Set Property action in the Button: Click trigger.
// When you click the button, the Set Property action sets the value of the Layout Width
// property in the parent node of the button.
public void Execute(PluginCommandParameter parameter)
{
// Create a Button 2D node named Resize in the RootPage node.
var buttonSetWidth = studio.ActiveProject.CreateProjectItem<Button2D>(
"Resize",
studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage"));
// Get the first Button: Click trigger in the Resize button.
var clickTrigger =
buttonSetWidth.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create a Set Property action in the Button: Click trigger.
var setPropertyAction = clickTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.SetPropertyAction"));
// Create a reference to the parent node of the Button 2D node.
ProjectItemReference<ExportedPropertyContainerItem> routingTarget = new NodeReference<Button2D>("..");
// In the Set Property action set the Target Item to the parent node of the Resize button.
// Target Item is the node to which you apply the action.
setPropertyAction.Set(Properties.MessageArgumentSetPropertyTargetItem, routingTarget);
// In the Set Property action set Target Property to Layout Width.
// Target Property is the property to which you apply the new value.
setPropertyAction.Set(Properties.MessageArgumentSetPropertyPropertyType, Properties.NodeWidth);
// In the Set Property action set Target Property Attribute to Whole property.
setPropertyAction.Set(
Properties.MessageArgumentSetPropertyPropertyAttribute,
// In the Set Property action set Value From to Fixed value.
setPropertyAction.Set(Properties.MessageArgumentSetPropertySourceType, EventArgumentValueTypeEnum.FIXED);
// In the Set Property action set Property Value to 500.
setPropertyAction.Set(Properties.MessageArgumentSetPropertyPropertyValue.Name, 500.0f);
}

To create a dispatch message action:

// This example creates a state manager with a state that sets the background color of the RootPage node,
// and a button with a Go To State action in the first Button: Click trigger.
// When you click the button, the background color of the RootPage node changes.
public void Execute(PluginCommandParameter parameter)
{
// Get the State Managers library which stores the state managers used in a Kanzi Studio project.
var stateManagerLibrary = studio.ActiveProject.StateManagerLibrary;
// Create a state manager named My State Manager in the State Managers library.
var myStateManager = studio.ActiveProject.CreateProjectItem<StateManager>(
stateManagerLibrary.GenerateUniqueChildName("My State Manager"),
stateManagerLibrary);
// Create a state group named My State Group in the My State Manager state manager.
var myStateGroup = studio.ActiveProject.CreateProjectItem<StateGroup>(
myStateManager.GenerateUniqueChildName("My State Group"),
myStateManager);
// Create a state named My State in the My State Group state group.
var myState = studio.ActiveProject.CreateProjectItem<State>(
myStateGroup.GenerateUniqueChildName("My State"),
myStateGroup);
// Create a state object named RootPage in the My State state.
var myStateObject = studio.ActiveProject.CreateProjectItem<StateObject>(
myState.GenerateUniqueChildName("RootPage"),
myState);
// Get the Brushes library in the Library > Materials and Textures which stores all the Brushes
// in a Kanzi Studio project.
var brushLibrary = studio.ActiveProject.BrushLibrary;
// Create a Color Brush named Blue Brush in the Brushes Library.
var blueBrush =
studio.ActiveProject.CreateBrush(
brushLibrary.GenerateUniqueChildName("Blue Brush"),
brushLibrary,
BrushTypeEnum.COLOR);
// Create a blue color.
var blueColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 255);
// Set the color of the Blue Brush brush to the blue color.
blueBrush.Set(blueBrush.PropertyTypes.ColorBrushColor, blueColor);
// Add and set the Background Brush in the RootPage state object to Blue Brush.
myStateObject.AddProperty(Properties.Node2DBackgroundBrush);
myStateObject.Set(Properties.Node2DBackgroundBrush.Name, blueBrush);
// Get the RootPage node in the Screens/Screen node.
var parentNode = studio.ActiveProject.GetProjectItem("Screens/Screen");
var rootPage = parentNode.GetChild<PageHost>("RootPage");
// Set the State Manager property of the RootPage node to MyStateManager.
rootPage.Set(Properties.NodeStateManager.Name, myStateManager);
// Create a Button 2D node named "Go Blue" in the RootPage node.
var goButton = studio.ActiveProject.CreateProjectItem<Button2D>(
"Go Blue",
rootPage);
// Create a Text Block 2D node in the Go Blue button.
var buttonLabel = studio.ActiveProject.CreateProjectItem<TextBlock2D>("Label", goButton);
// Set the Text property of the Text Block 2D node to Go Blue.
buttonLabel.Set(Properties.TextConceptText, "Go Blue");
// Get the first Button: Click trigger in the Go Blue button.
var clickTrigger =
goButton.Triggers.First(
trigger => trigger.Get(
Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// In the Button: Click trigger create a trigger action, and set:
// * Trigger Action Type to Dispatch Message Action
// * Message Type to Go To State
var goToStateAction = clickTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.DispatchMessageAction"));
goToStateAction.DispatchMessageActionMessageType = studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.StateManager.GoToState");
// In the Go To State action set Target Item to the RootPage node.
goToStateAction.RoutingTarget = new NodeReference<PageHost>(rootPage);
// In the Go To State action set State to My State.
goToStateAction.Set(Properties.MessageArgumentStateManagerState.Name, "My State");
}

To create a dispatch message action and set the target item using a relative path:

public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Page node named Page1 in the RootPage node.
var page1 = studio.ActiveProject.CreateProjectItem<Page>(rootPage.GenerateUniqueChildName("Page1"), rootPage);
// Set the Default Subpage property of the RootPage node to the Page1 node.
rootPage.Set(Properties.PageHostDefaultSubPage.Name, "Page1");
// Create a Page node named Page2 in the RootPage node.
studio.ActiveProject.CreateProjectItem<Page>(rootPage.GenerateUniqueChildName("Page2"), rootPage);
// Create a Button 2D node named "Next" in the RootPage node.
var nextButton = studio.ActiveProject.CreateProjectItem<Button2D>("Next", rootPage);
// Create a Text Block 2D node named "Next page" in the Next button.
var buttonLabel = studio.ActiveProject.CreateProjectItem<TextBlock2D>("Next page", nextButton);
// In the Text Block 2D node set the Text property to Next page.
buttonLabel.Set(Properties.TextConceptText, "Next page");
// Get the first Button: Click trigger in the Next button.
var clickTrigger =
nextButton.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// In the Button: Click trigger create a trigger action, and set:
// * Trigger Action Type to Dispatch Message Action
// * Message Type to Navigate To Page
var navigateToPageAction = clickTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.DispatchMessageAction"));
navigateToPageAction.DispatchMessageActionMessageType = studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Page.Navigate");
// In the Navigate To Page action use a relative path to set Target Item to the Page2 node.
navigateToPageAction.RoutingTarget = new NodeReference<Page>("../Page2");
}

◆ CreateCondition() [1/2]

TriggerConditionItem CreateCondition ( )

Creates a trigger condition.

Trigger conditions enable you to set which conditions must be met for the trigger to set off.

Returns
The trigger condition.
See also
TriggerConditionItem

Examples

To create an empty trigger condition:

public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Button 2D node in the RootPage node.
var button =
studio.ActiveProject.CreateProjectItem<Button2D>(rootPage.GenerateUniqueChildName("Button 2D"), rootPage);
// Get the first Button: Click trigger in the Button 2D node.
var clickTrigger = button.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create an empty trigger condition for the first Button: Click trigger in the Button 2D node.
var triggerCondition = clickTrigger.CreateCondition();
}

◆ CreateCondition() [2/2]

TriggerConditionItem CreateCondition ( [NotNull] TriggerConditionItem toClone)

Creates a trigger condition by cloning an existing trigger condition.

Parameters
toCloneThe trigger condition that you want to clone to create a new trigger condition.
Returns
The trigger condition.
See also
TriggerConditionItem

Examples

To create a trigger condition by cloning an existing trigger condition:

public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Button 2D node in the RootPage node.
var button =
studio.ActiveProject.CreateProjectItem<Button2D>(rootPage.GenerateUniqueChildName("Button 2D"), rootPage);
// Get the first Button: Click trigger in the Button 2D node.
var clickTrigger = button.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create an empty trigger condition for the first Button: Click trigger in the Button 2D node.
var triggerCondition = clickTrigger.CreateCondition();
// Create a trigger condition by cloning the empty trigger condition that you created.
clickTrigger.CreateCondition(triggerCondition);
}

◆ DeleteAction()

bool DeleteAction ( [NotNull] TriggerActionItem action)

Deletes a trigger action.

Parameters
actionThe trigger action that you want to delete.
Returns
When it deletes the action successfully, true, otherwise false.

Examples

To delete a trigger action:

// To delete a trigger action you first have to get the trigger and the action, and then use the DeleteAction
// function to delete the action.
public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Button 2D node in the RootPage node.
var button =
studio.ActiveProject.CreateProjectItem<Button2D>(rootPage.GenerateUniqueChildName("Button 2D"), rootPage);
// Get the first Button: Click trigger in the Button 2D node.
var clickTrigger = button.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// In the Button: Click trigger create a Write Log action.
var writeLogAction = clickTrigger.CreateAction(studio.ActiveProject.TriggerActionTypeLibrary.GetItemByName("Kanzi.WriteLogAction"));
// Use the DeleteAction function to delete the Write Log action.
clickTrigger.DeleteAction(writeLogAction);
}

◆ DeleteCondition()

bool DeleteCondition ( [NotNull] TriggerConditionItem condition)

Deletes a trigger condition.

Parameters
conditionThe trigger condition that you want to delete.
Returns
When it deletes the condition successfully, true, otherwise false.

Examples

To delete a trigger condition:

public void Execute(PluginCommandParameter parameter)
{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Button 2D node in the RootPage node.
var button =
studio.ActiveProject.CreateProjectItem<Button2D>(rootPage.GenerateUniqueChildName("Button 2D"), rootPage);
// Get the first Button: Click trigger in the Button 2D node.
var clickTrigger = button.Triggers.First(
trigger => trigger.Get(Properties.TriggerMessageType) == studio.ActiveProject.MessageTypeLibrary.GetItemByName("Message.Button.Click"));
// Create an empty trigger condition for the first Button: Click trigger in the Button 2D node.
var triggerCondition = clickTrigger.CreateCondition();
// Use the DeleteCondition function to delete the trigger condition.
clickTrigger.DeleteCondition(triggerCondition);
}

Property Documentation

◆ Actions

IEnumerable<TriggerActionItem> Actions
get

Gets the actions in a trigger.

◆ Conditions

IEnumerable<TriggerConditionItem> Conditions
get

Gets the conditions in a trigger.

◆ IsMessageTrigger

bool IsMessageTrigger
get

Gets whether the trigger is a message trigger.

◆ MessageSource

Node MessageSource
getset

Gets or sets the target item from which to intercept messages.

Use either MessageSource or #RelativeMessageSource to set the specific target item from which to intercept messages.

Examples

To create a trigger and set the target item from which the trigger intercepts messages:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootPage node in the Screens/Screen node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen").GetChild<Page>("RootPage");
// Create a Toggle Button Group 2D node in the RootPage node.
var toggleButtonGroup = studio.ActiveProject.CreateProjectItem<ToggleButtonGroup2D>(
rootPage.GenerateUniqueChildName("Toggle Button Group 2D"),
rootPage);
// Create a Stack Layout 2D node in the Toggle Button Group 2D node.
var stackLayout = studio.ActiveProject.CreateProjectItem<StackLayout2D>("Stack Layout 2D", toggleButtonGroup);
// Create two Toggle Button 2D nodes in the Toggle Button Group 2D node.
var toggleButton1 = studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 1", stackLayout);
var toggleButton2 = studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 2", stackLayout);
// Create a Toggle Button Group: Toggled trigger in the Toggle Button Group 2D node.
var toggledTrigger = toggleButtonGroup.CreateTrigger(studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName(NodeComponentTypeNames.MessageTrigger));
toggledTrigger.Set(Properties.TriggerMessageType, studio.ActiveProject.MessageTypeLibrary.GetItemByName(MessageTypeNames.MessageToggleButtonGroupConceptToggled));
// To set the Toggle Button Group: Toggled trigger to intercept messages only from Toggle Button 1,
// set the Message Source of the Toggle Button Group: Toggled trigger to Toggle Button 1.
toggledTrigger.MessageSource = toggleButton1;
}

◆ PropertyTypes

Implements NodeComponent.

◆ RelativeMessageSource

NodeReference<Node> RelativeMessageSource
getset

Gets or sets the relative path to the target item from which to intercept messages:

  • Reference to the target item to intercept messages from a specific target item
  • Null to intercept messages from all sources

Use either RelativeMessageSource or #MessageSource to set the specific target item from which to intercept messages.

Examples

To create a trigger and set the relative target item from which the trigger intercepts messages:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootPage node in the Screens/Screen node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen").GetChild<Page>("RootPage");
// Create a Toggle Button Group 2D node in the RootPage node.
var toggleButtonGroup = studio.ActiveProject.CreateProjectItem<ToggleButtonGroup2D>(
rootPage.GenerateUniqueChildName("Toggle Button Group 2D"),
rootPage);
// Create a Stack Layout 2D node in the Toggle Button Group 2D node.
var stackLayout = studio.ActiveProject.CreateProjectItem<StackLayout2D>("Stack Layout 2D", toggleButtonGroup);
// Create two Toggle Button 2D nodes in the Toggle Button Group 2D node.
studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 1", stackLayout);
studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 2", stackLayout);
// Create a Toggle Button Group: Toggled trigger in the Toggle Button Group 2D node.
var toggledTrigger = toggleButtonGroup.CreateTrigger(studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName(NodeComponentTypeNames.MessageTrigger));
toggledTrigger.Set(Properties.TriggerMessageType, studio.ActiveProject.MessageTypeLibrary.GetItemByName(MessageTypeNames.MessageToggleButtonGroupConceptToggled));
// Create a reference to the Toggle Button 1 node.
NodeReference<Node> relativeMessageSource = new NodeReference<Node>("Stack Layout 2D/Toggle Button 1");
// To set the Toggle Button Group: Toggled trigger to intercept messages only from Toggle Button 1,
// set the Relative Message Source of the Toggle Button Group: Toggled trigger to Toggle Button 1.
toggledTrigger.RelativeMessageSource = relativeMessageSource;
}

To create a trigger and set it to intercept messages from all sources:

public void Execute(PluginCommandParameter parameter)
{
// Get the RootPage node in the Screens/Screen node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen").GetChild<Page>("RootPage");
// Create a Toggle Button Group 2D node in the RootPage node.
var toggleButtonGroup = studio.ActiveProject.CreateProjectItem<ToggleButtonGroup2D>(
rootPage.GenerateUniqueChildName("Toggle Button Group 2D"),
rootPage);
// Create a Stack Layout 2D node in the Toggle Button Group 2D node.
var stackLayout = studio.ActiveProject.CreateProjectItem<StackLayout2D>("Stack Layout 2D", toggleButtonGroup);
// Create two Toggle Button 2D nodes in the Toggle Button Group 2D node.
studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 1", stackLayout);
studio.ActiveProject.CreateProjectItem<ToggleButton2D>("Toggle Button 2", stackLayout);
// Create a Toggle Button Group: Toggled trigger in the Toggle Button Group 2D node.
var toggledTrigger = toggleButtonGroup.CreateTrigger(studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName(NodeComponentTypeNames.MessageTrigger));
toggledTrigger.Set(Properties.TriggerMessageType, studio.ActiveProject.MessageTypeLibrary.GetItemByName(MessageTypeNames.MessageToggleButtonGroupConceptToggled));
// To set the Toggle Button Group: Toggled trigger to intercept messages from all sources,
// set the Relative Message Source of the Toggle Button Group: Toggled trigger to <No Item>.
toggledTrigger.RelativeMessageSource = null;
}

◆ RoutingMode

MessageRoutingModeEnum RoutingMode
getset

Gets or sets the message routing mode:

  • TUNNELING to intercept only tunneling messages
  • BUBBLING to intercept only bubbling messages
  • TUNNELING_AND_BUBBLING to intercept tunneling and bubbling messages

◆ SetHandled

bool SetHandled
getset

Gets or sets the message handling mode:

  • TRUE to intercept and handle the message.The message stops here, and does not continue neither bubbling nor tunneling in the project tree.
  • FALSE to intercept the message, but let the message continue bubbling or tunneling in the project tree.

◆ TriggerMessageType

MessageType TriggerMessageType
get

Gets the Trigger Message Type.

See also
Project.TriggerActionTypeLibrary