Table of Contents

Property SelectedComponents

Namespace
Alternet.FormDesigner.WinForms
Assembly
Alternet.FormDesigner.v9.dll

SelectedComponents

Contains list of selected components or controls.

[Browsable(false)]
public IEnumerable<IComponent> SelectedComponents { get; set; }

Property Value

IEnumerable<IComponent>

Examples

Here is how to use a SelectedComponents in the C# code:

using Alternet.FormDesigner.WinForms;

public partial class Form1 : Form
{
    private void Form1_Load(object sender, EventArgs e)
    {
        var formDesigner = new FormDesignerControl();
        formDesigner.AutoSaveToSource = false;
        formDesigner.Dock = System.Windows.Forms.DockStyle.Fill;
        formDesigner.Parent = this;
        var propertyGrid = new PropertyGridControl;
        propertyGrid.SelectedObjects = formDesigner.SelectedComponents.ToArray();
    }
}

Here is how to use a SelectedComponents in the Visual Basic code:

Imports System
Imports Alternet.FormDesigner.WinForms

Partial Public Class Form1
    Inherits Form

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim formDesigner = New FormDesignerControl()
        formDesigner.AutoSaveToSource = False
        formDesigner.Dock = System.Windows.Forms.DockStyle.Fill
        formDesigner.Parent = Me
        Dim propertyGrid = New PropertyGridControl()
        propertyGrid.SelectedObjects = formDesigner.SelectedComponents.ToArray()
    End Sub
End Class

Remarks

Other controls connected to the designer, like OutlineControl or PropertyGridControl, display their content according to the SelectedComponents property. You can change SelectedComponents programmatically or by selecting different controls from the Form Designer, Property Grid, or Outline Control.