Back to Devexpress

PGridOptionsBehavior.RefreshOnSelectedObjectChanges Property

windowsforms-devexpress-dot-xtraverticalgrid-dot-pgridoptionsbehavior-6b42c0e3.md

latest4.6 KB
Original Source

PGridOptionsBehavior.RefreshOnSelectedObjectChanges Property

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

Declaration

csharp
[DefaultValue(true)]
[XtraSerializableProperty]
public virtual bool RefreshOnSelectedObjectChanges { get; set; }
vb
<DefaultValue(True)>
<XtraSerializableProperty>
Public Overridable Property RefreshOnSelectedObjectChanges As Boolean

Property Value

TypeDefaultDescription
Booleantrue

true if the control updates the content when the selected object’s property changes; otherwise, false.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to RefreshOnSelectedObjectChanges
PropertyGridControl

.OptionsBehavior .RefreshOnSelectedObjectChanges

|

Remarks

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.

Example

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.

csharp
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;
}
vb
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

Refresh()

UpdateRows()

SelectedObject

SelectedObjects

PGridOptionsBehavior Class

PGridOptionsBehavior Members

DevExpress.XtraVerticalGrid Namespace