Click or drag to resize

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

Constructs a new control panel item.

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

Parameters

controlVisual
Type: Demo3D.VisualsVisual
The visual that's bound to the control.
name
Type: SystemString
The name of the control.
control
Type: SystemString
Widget for displaying the control. Must match the list of supported controls.
propertyName (Optional)
Type: SystemString
The name of the property on controlVisual (or null to use name).
canRead (Optional)
Type: SystemBoolean
True if it's meaningful to read the value of the property.
canWrite (Optional)
Type: SystemBoolean
True if the control can write a value to the property.
panelName (Optional)
Type: SystemString
Control panel name (or null).
Examples
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