Expose underlying controls of a custom app in layout scripting
- Last UpdatedSep 20, 2024
- 2 minute read
If you have created a custom app that contains an underlying .NET Winforms or Windows Presentation Foundation (WPF) control, you can show your control's properties, methods, and events in the Layout or ViewApp editors.
You must do the following:
-
Include an ExpandableObjectConverter attribute in your control code
[TypeConverter(Typeof(ExpandableObjectConverter))]
-
Expose the control's methods, properties, and events using a public declaration similar to the following example code snippet.
Example
[TypeConverter(Typeof(ExpandableObjectConverter))]
public AlarmAck AlarmAckControl
{
get => this.AlarmAckControl;
set => this.AlarmAckControl = value;
}
-
Add this public property in the app's manifest file if you have one to enable control properties and events from the Properties grid.
After making the required code changes to your custom app, import the app into the Galaxy.
Place your app onto a layout pane and select Properties to show your app's properties. The following example shows the properties of the AlarmApp. Notice the control name (AlarmClientControl) appended to the property group as a prefix.

At the bottom of the Properties grid, the Available Events property shows a list of all events of the control when you select the data entry field.
When you open the Layout script editor, and create a named script, the editor's Autocomplete feature presents a selectable list of methods and properties as you complete a statement. Notice the MyContent namespace, the instance name of the control, and the custom control's exposed .NET Focus method in the following example.

You can also create event handler scripts that incorporate exposed events from a custom control that is selected as the source.
