event element

Defines a Power FX expression that can be configured within Power Apps Studio, then triggered within the component code.

Available for

Canvas apps

Properties

Name Description Type Required Available for
name Name of the event string Yes Canvas apps
display-name-key Used in the customization screens as localized strings that describes the name of the event. string Yes Canvas apps
description-key Used in the customization screens as localized strings that describes the description of the event. string Optional Canvas apps
pfx-default-value The default Power Fx expression value provided to the component. See Remarks Optional Canvas apps

Remarks

Use the pfx-default-value property value to evaluate events and properties using Power Fx expressions instead of static default values. You can use this to:

  • Responsively size the control
  • Access connectors
  • Provide sample data
  • Reference theme properties
  • Custom events

Note

  • You can use any Power Fx expression, but you must make sure the expression is valid when importing the control.
  • If you use inner quotes or other special characters, wrap the value in single quotes, For example: pfx-default-value='"Test"'
  • You can reference other controls (including screens) and their properties. Write these references as: %ControlName.ID%.ControlProperty. For example: pfx-default-value='SubmitForm(%MyFormName.ID%)'
  • Write enums, like DisplayType and ScreenTransition as: %EnumName.RESERVED%.EnumValue. For example: pfx-default-value='Back(%ScreenTransition.RESERVED%.Cover)'
  • If pfx-default-value is included, then it takes precedence over default-value.

Parent Elements

Element Description
control Defines the component's namespace, version and display information.

Example

<event name="OnSelectCustomButton"
   pfx-default-value='SubmitForm(%MyFormName.ID%); Back(%ScreenTransition.RESERVED%.Cover)'
   display-name-key="OnSelectCustomButton_Display_Key"
   description-key="OnSelectCustomButton_Desc_Key" />

Power Apps component framework manifest schema reference
Power Apps component framework API reference
Power Apps component framework overview