You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# WPF Property Grid - Inspect and Edit Object Properties
9
9
10
-
In this example, a user selects a contact, and the [`PropertyGridControl`](https://docs.devexpress.com/WPF/DevExpress.Xpf.PropertyGrid.PropertyGridControl) displays its properties. The user can modify these properties directly in the panel.
10
+
This example uses the WPF [`PropertyGridControl`](https://docs.devexpress.com/WPF/DevExpress.Xpf.PropertyGrid.PropertyGridControl) to inspect and modify properties of data objects displayed in the [`GridControl`](https://docs.devexpress.com/WPF/DevExpress.Xpf.Grid.GridControl) control. Use the `PropertyGridControl` to create object inspectors inspired by the `Properties` window in the Visual Studio IDE.
The view model exposes a list of contacts. Each contact includes the following fields: `FirstName`, `LastName`, `Email`, `Phone`, `Address`, `City`, `State`, and `Zip`.
18
+
The `Contact` class declares public bindable properties. The `PropertyGridControl` inspects the object's public properties and allows users to browse and modify them. The `Contact` class implements property change notifications. Updates made in the `PropertyGridControl` are applied immediately to the source object and reflected in the `GridControl`.
19
+
20
+
```csharp
21
+
publicclassContact : BindableBase {
22
+
string_FirstName;
23
+
publicstringFirstName {
24
+
get { return_FirstName; }
25
+
set {
26
+
_FirstName=value;
27
+
RaisePropertyChanged(() =>FirstName);
28
+
}
29
+
}
30
+
// ...
31
+
}
32
+
```
33
+
34
+
### Data Source
35
+
36
+
The `ViewModel` exposes a typed collection of contacts.
19
37
20
38
```csharp
21
39
publicclassViewModel {
@@ -31,44 +49,29 @@ public class ViewModel {
31
49
City="Whitinsville",
32
50
State="MA",
33
51
Zip="01582"
34
-
}, ...
52
+
},
53
+
// ...
35
54
};
36
55
}
37
56
}
38
57
```
39
58
40
-
### Create Editable Object
59
+
### Property Grid Configuration
41
60
42
-
The `Contact`class defines fields that appear in the `PropertyGridControl`. This class supports property change notifications, so all updates in the UI are immediately applied to the data object:
61
+
This example creates two Property Grid controls and displays them in tab containers. The first Property Grid control inspects the `Contact`object that corresponds to the focused item in the `GridControl`. The second Property Grid control inspects `Contact` objects that correspond to selected items in the `GridControl`:
43
62
44
-
```csharp
45
-
publicclassContact : BindableBase {
46
-
string_FirstName;
47
-
publicstringFirstName {
48
-
get { return_FirstName; }
49
-
set {
50
-
_FirstName=value;
51
-
RaisePropertyChanged(() =>FirstName);
52
-
}
53
-
}
63
+
```xaml
64
+
<dx:DXTabControl>
65
+
<dx:DXTabItemHeader="Edit properties of the focused row">
0 commit comments