windowsforms-devexpress-dot-xtraverticalgrid-dot-pgridoptionsbehavior-6b42c0e3.md
Gets or sets whether the control automatically updates the content when the selected object’s property changes.
Namespace : DevExpress.XtraVerticalGrid
Assembly : DevExpress.XtraVerticalGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
[DefaultValue(true)]
[XtraSerializableProperty]
public virtual bool RefreshOnSelectedObjectChanges { get; set; }
<DefaultValue(True)>
<XtraSerializableProperty>
Public Overridable Property RefreshOnSelectedObjectChanges As Boolean
| Type | Default | Description |
|---|---|---|
| Boolean | true |
true if the control updates the content when the selected object’s property changes; otherwise, false.
|
You can access this nested property as listed below:
| Object Type | Path to RefreshOnSelectedObjectChanges |
|---|---|
| PropertyGridControl |
.OptionsBehavior .RefreshOnSelectedObjectChanges
|
If the selected object (see SelectedObject, SelectedObjects) supports the INotifyPropertyChanged interface, the control automatically updates its content when a property changes. Set the RefreshOnSelectedObjectChanges property to false to prevent the automatic updates. To refresh the content manually, call the Refresh() or UpdateRows() method.
The code below shows how the INotifyPropertyChanged interface can be implemented. Since the RefreshOnSelectedObjectChanges property is set to false , the control does not update the content when the selected object changes.
propertyGridControl1.SelectedObject = new MyObject();
propertyGridControl1.OptionsBehavior.RefreshOnSelectedObjectChanges = false;
public class MyObject : INotifyPropertyChanged {
object myProperty;
public object MyProperty {
get {
return myProperty;
}
set {
myProperty = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("MyProperty"));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
propertyGridControl1.SelectedObject = New MyObject()
propertyGridControl1.OptionsBehavior.RefreshOnSelectedObjectChanges = False
Public Class MyObject
Implements INotifyPropertyChanged
Private fMyProperty As Object
Public Property MyProperty() As Object
Get
Return fMyProperty
End Get
Set(ByVal value As Object)
fMyProperty = value
PropertyChangedEvent?.Invoke(Me, New PropertyChangedEventArgs("MyProperty"))
End Set
End Property
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
End Class
See Also