Table of Contents

Property SelectedObjects

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

SelectedObjects

When implemented by a class, gets or sets the currently selected objects.

[Browsable(false)]
public object[] SelectedObjects { get; set; }

Property Value

object[]

Examples

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

using Alternet.FormDesigner.WinForms;
using System;

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.Left;
        formDesigner.Parent = this;
        var propertyGrid = new PropertyGridControl();
        propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
        propertyGrid.SelectedObjects = formDesigner.SelectedComponents.ToArray();
    }
}

Here is how to use a SelectedObjects 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 = Windows.Forms.DockStyle.Left
        formDesigner.Parent = Me
        Dim propertyGrid = New PropertyGridControl()
        propertyGrid.Dock = Windows.Forms.DockStyle.Fill
        propertyGrid.SelectedObjects = formDesigner.SelectedComponents.ToArray()
    End Sub
End Class

Remarks

Once PropertyGridControl is connected to the designer, it displays their content according to the SelectedComponents property. SelectedObjects property provides the same list of the selected components. You can change SelectedObjects programmatically or by selecting different controls from the Form Designer, connected to the Property Grid.