SelectedItems Property
SelectedItems
Contains list of selected DesignItem.
Declaration
public ICollection<DesignItem> SelectedItems { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<DesignItem> |
Implements
Remarks
Other controls connected to the designer, like OutlineControl or PropertyGridControl, display their content according to the SelectedItems property. You can change SelectedItems by selecting different control from the Form Designer, Property Grid, or Outline Control.
Examples
Here is how to use a SelectedItems in the C# code:
using System;
using Alternet.FormDesigner.Wpf;
using Alternet.FormDesigner.Wpf.PropertyGrid;
public partial class MainWindow : Window
{
private PropertyGridControl propertyGrid = new PropertyGridControl();
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var formDesigner = new FormDesignerControl();
formDesigner.AutoSaveToSource = false;
propertyGrid.FormDesigner = formDesigner;
formDesigner.SelectionChanged += FormDesignerControl_SelectionChanged;
}
private void FormDesignerControl_SelectionChanged(object sender, EventArgs e)
{
var designer = (FormDesignerControl)sender;
propertyGrid.SelectedItems = designer.SelectedItems.ToArray();
}
}
Here is how to use a SelectedItems in the Visual Basic code:
Imports System
Imports Alternet.FormDesigner.Wpf
Imports Alternet.FormDesigner.Wpf.PropertyGrid
Partial Public Class MainWindow
Inherits Window
Private propertyGrid As PropertyGridControl = New PropertyGridControl()
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim formDesigner = New FormDesignerControl()
formDesigner.AutoSaveToSource = False
propertyGrid.FormDesigner = formDesigner
AddHandler formDesigner.SelectionChanged, AddressOf FormDesignerControl_SelectionChanged
End Sub
Private Sub FormDesignerControl_SelectionChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim designer = CType(sender, FormDesignerControl)
propertyGrid.SelectedItems = designer.SelectedItems.ToArray()
End Sub
End Class