DataGrid::AllowNavigationChanged Event

 

Occurs when the AllowNavigation property has changed.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
event EventHandler^ AllowNavigationChanged {
	void add(EventHandler^ value);
	void remove(EventHandler^ value);
}

If the AllowNavigation property is set to false, then no links to child tables are shown.

The following code example resets the AllowNavigation property and raises the AllowNavigationChanged event.

private:
   // Create an instance of the 'AllowNavigationChanged' EventHandler.
   void CallAllowNavigationChanged()
   {
      myDataGrid->AllowNavigationChanged += gcnew EventHandler( this, &MyDataGrid::Grid_AllowNavChange );
   }

   // Set the 'AllowNavigation' property on click of a button.
private:
   void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      if ( myDataGrid->AllowNavigation == true )
            myDataGrid->AllowNavigation = false;
      else
            myDataGrid->AllowNavigation = true;
   }

   // Raise the event when 'AllowNavigation' property is changed.
private:
   void Grid_AllowNavChange( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      String^ myString = "AllowNavigationChanged event raised, Navigation ";
      bool myBool = myDataGrid->AllowNavigation;

      // Create appropriate alert message.
      myString = String::Concat( myString, myBool ? (String^)" is " : " is not ", "allowed" );

      // Show information about navigation.
      MessageBox::Show( myString, "Navigation information" );
   }

.NET Framework
Available since 1.1
Return to top
Show: