wpf-devexpress-dot-xpf-dot-propertygrid-dot-propertygridcontrol-48731ed3.md
Gets or sets the object whose properties are currently displayed within the property grid. This is a dependency property.
Namespace : DevExpress.Xpf.PropertyGrid
Assembly : DevExpress.Xpf.PropertyGrid.v25.2.dll
NuGet Package : DevExpress.Wpf.PropertyGrid
public object SelectedObject { get; set; }
Public Property SelectedObject As Object
| Type | Description |
|---|---|
| Object |
An object that represents the data source from which the grid retrieves its data.
|
The Property Grid allows browsing and editing properties of the object specified by the SelectedObject property.
To bind the Property Grid to a collection of objects, use the PropertyGridControl.SelectedObjects property.
Refer to the following help topic for more information: Property Definitions.
The following code snippets (auto-collected from DevExpress Examples) contain references to the SelectedObject property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
wpf-propertygrid-add-an-item-to-a-collection-or-a-dictionary/CS/Dictionary/MainWindow.xaml#L14
</Grid.ColumnDefinitions>
<dxprg:PropertyGridControl Name="pGrid" SelectedObject="{Binding Path=CurrentItem, ElementName=grid}" Grid.Column="1"
ShowCategories="False" CellValueChanged="pGrid_CellValueChanged" >
wpf-property-grid-apply-data-annotation-attributes/CS/MainWindow.xaml#L13
</Window.Resources>
<dxprg:PropertyGridControl SelectedObject="{Binding Path=.}" ExpandCategoriesWhenSelectedObjectChanged="True"/>
</Window>
ShowEditorButtons="True"
SelectedObject="{Binding Department}"/>
</Window>
wpf-diagram-mdi/CS/MainWindow.xaml#L146
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectedObject="{Binding Path=(dxdo:DockLayoutManager.DockLayoutManager).ActiveDockItem.(dxdiag:DiagramControl.Diagram).SelectionModel, RelativeSource={RelativeSource Self}}"
ShowCategories="False" />
wpf-property-grid-specify-custom-collection-edit-actions/CS/MainWindow.xaml.cs#L10
InitializeComponent();
propertyGrid.SelectedObject = new IssueView {
ProductName = "PropertyGridControl",
wpf-property-grid-show-tooltips-in-new-item-menu/CS/PropertyGridMenuOpening/MainWindow.xaml.cs#L8
InitializeComponent();
propertyGrid.SelectedObject = new IssueView {
ProductName = "PropertyGridControl",
wpf-property-grid-specify-custom-collection-edit-actions/VB/MainWindow.xaml.vb#L13
Me.InitializeComponent()
Me.propertyGrid.SelectedObject = New IssueView With {.ProductName = "PropertyGridControl", .UserName = "Peter Dirk", .Issues = New IssueList From {New Bug With {.Header = "Rendering problem", .Assignee = "Jack Plank", .Owner = "Adam Smith", .Severity = Severity.Severe}, New Question With {.Header = "Rendering problem", .Assignee = "Elsa Lynch", .Owner = "Peter Dirk"}, New BreakingChange With {.Header = "Layout update", .ChangeType = ChangeType.BehaviorChange, .Owner = "Adam Smith"}, New Question With {.Header = "Focusing problem", .Assignee = "Elsa Lynch", .Owner = "Peter Dirk"}}}
End Sub
wpf-property-grid-show-tooltips-in-new-item-menu/VB/PropertyGridMenuOpening/MainWindow.xaml.vb#L11
Me.InitializeComponent()
Me.propertyGrid.SelectedObject = New IssueView With {.ProductName = "PropertyGridControl", .Issues = New IssueList From {New Bug With {.Header = "Rendering problem", .Assignee = "Jack Plank", .Owner = "Adam Smith", .Severity = Severity.Severe}, New Question With {.Header = "Rendering problem", .Assignee = "Elsa Lynch", .Owner = "Adam Smith"}, New BreakingChange With {.Header = "Layout update", .ChangeType = ChangeType.BehaviorChange, .Owner = "Adam Smith"}}}
End Sub
See Also