Xceed Grid for WinForms v4.3 Documentation
Welcome to Xceed Grid for WinForms v4.3 / Basic Concepts / Events / Using the PropertyChanged events

In This Topic
    Using the PropertyChanged events
    In This Topic

    Raised when the value of a grid element's property changes to provide notification that the property has been modified. These events can be used, for example, to update a text box with new information when something on the grid changes.

    Basic steps - C#

    To subscribe to a PropertyChanged event, for example the GridControl.CurrentRowChanged event, the following steps must be performed:

    • Obtain a reference to a GridControl object. 

    • Subscribe to the CurrentRowChanged event of the GridControl object using the default delegate class. 

    • Create a new method that will handle the events that are raised. 

    • Place the desired code in the newly created event handler.

    Basic steps - VB.NET

    To subscribe to a PropertyChanged event, for example the GridControl.CurrentRowChanged event,   the following steps must be performed:

    • Obtain a reference to a GridControl object. 

    • Subscribe to the CurrentRowChanged event of the GridControl object using the AddHandler/AddressOf keywords. 

    • Create a new method that will handle the events that are raised. 

    • Place the desired code in the newly created event handler.

    Demonstration

    This example assumes that you are in a Windows application.

    VB.NET Copy Code

    Imports Xceed.Grid

    Dim grid As New GridControl()
    AddHandler grid.CurrentRowChanged, AddressOf Me.grid_CurrentRowChanged

    Private Sub grid_CurrentRowChanged( ByVal sender As Object, ByVal e As EventArgs )
      ' Add code here
    End Sub

    ' If you no longer wish to handle the CurrentRowChanged events that are raised,
    ' you can unsubscribe from the event notification by doing the following:
    RemoveHandler grid.CurrentRowChanged, AddressOf Me.grid_CurrentRowChanged

    C# Copy Code

    using Xceed.Grid;
    GridControl grid = new GridControl();
    grid.CurrentRowChanged += new EventHandler( this.grid_CurrentRowChanged );

    // This method will handle the CurrentRowChanged events that are raised.
    private void grid_CurrentRowChanged( object sender, EventArgs e )
    {
      //  Add code here
    }

    // If you no longer wish to handle the CurrentRowChanged events that are raised,
    // you can unsubscribe from the event notification by doing the following:
    grid.CurrentRowChanged -= new EventHandler( this.grid_CurrentRowChanged );

    Remarks

    The PropertyChanged events are not raised when the value of a parent's property changes.