Click or drag to resize

ControlPanelItem(Visual, String, String, String, Boolean, Boolean, String) Constructor

Constructs a new control panel item.

Namespace: Demo3D.ControlPanel
Assembly: Demo3D.Core (in Demo3D.Core.dll) Version: 19.00.00
Syntax
C#
public ControlPanelItem(
	Visual controlVisual,
	string name,
	string control,
	string propertyName = null,
	bool canRead = true,
	bool canWrite = true,
	string panelName = null
)

Parameters

controlVisual  Visual
The visual that's bound to the control.
name  String
The name of the control.
control  String
Widget for displaying the control. Must match the list of supported controls.
propertyName  String  (Optional)
The name of the property on controlVisual (or null to use name).
canRead  Boolean  (Optional)
True if it's meaningful to read the value of the property.
canWrite  Boolean  (Optional)
True if the control can write a value to the property.
panelName  String  (Optional)
Control panel name (or null).
Example
C#
// Create a new control panel item, and add to the grid on reset.
[Auto] void ControlPanelItems(Visual sender, ControlPanelItemsResults items)
{
    // A lamp indicating if IsMotorOn is true.
    items.Add(new ControlPanelItem(sender, "ControlName", Control.Lamp, ControlProperty.Create(sender, "IsMotorOn")));

    // A pushable lamp with IsPushed and IsOn bound to two seperate properties.
    items.Add(new ControlPanelItem(sender, "ControlName", Control.PushableLamp, new ControlProperty[] {
        ControlProperty.Create(sender, "IsMotorOn"),
        ControlProperty.Create(sender, "IsLiftMotorOn")
    }));

    // A red lamp indicating if IsMotorOn is true.
    items.Add(new ControlPanelItem(sender, "ControlName", "Lamp(LampColor=Red)", ControlProperty.Create(sender, "IsMotorOn")));

    // A red pushable lamp with IsPushed and IsOn bound to two seperate properties.
    items.Add(new ControlPanelItem(sender, "ControlName", "PushableLamp(ManualRelease=true, LampColor=Red)", new ControlProperty[] {
        ControlProperty.Create(sender, "IsMotorOn"),
        ControlProperty.Create(sender, "IsLiftMotorOn")
    }));

    //A red lamp indicating if IsMotorOn is true.
    items.Add(new ControlPanelItem(sender, "ControlName", Control.Lamp, "IsMotorOn"));
}
See Also