Freigeben über


DataGrid.ParentRowsVisibleChanged-Ereignis

Tritt ein, wenn der Wert der ParentRowsVisible-Eigenschaft geändert wird.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Event ParentRowsVisibleChanged As EventHandler
'Usage
Dim instance As DataGrid
Dim handler As EventHandler

AddHandler instance.ParentRowsVisibleChanged, handler
public event EventHandler ParentRowsVisibleChanged
public:
event EventHandler^ ParentRowsVisibleChanged {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
/** @event */
public void add_ParentRowsVisibleChanged (EventHandler value)

/** @event */
public void remove_ParentRowsVisibleChanged (EventHandler value)
JScript unterstützt die Verwendung von Ereignissen, aber nicht die Deklaration von neuen Ereignissen.

Hinweise

Weitere Informationen zum Behandeln von Ereignissen finden Sie unter Behandeln von Ereignissen.

Beispiel

Private Sub CallParentRowsVisibleChanged()
    AddHandler myDataGrid.ParentRowsVisibleChanged, AddressOf _
                                              DataGridParentRowsVisibleChanged_Clicked
End Sub 'CallParentRowsVisibleChanged


' Set the 'ParentRowsVisible' property on click of a button.
Private Sub ToggleVisible_Clicked(ByVal sender As Object, ByVal e As EventArgs)
    If myDataGrid.ParentRowsVisible = True Then
        myDataGrid.ParentRowsVisible = False
    Else
        myDataGrid.ParentRowsVisible = True
    End If
End Sub 'ToggleVisible_Clicked

' raise the event when 'ParentRowsVisible' property is changed.
Private Sub DataGridParentRowsVisibleChanged_Clicked(ByVal sender As Object, ByVal e As EventArgs)
    Dim myMessage As String = "ParentRowsVisibleChanged event raised, Parent row is : "
    Dim visible As Boolean = myDataGrid.ParentRowsVisible
    myMessage += IIF(visible, " ", "Not") + "Visible"
    MessageBox.Show(myMessage, "ParentRowsVisible information")
End Sub 'DataGridParentRowsVisibleChanged_Clicked
private void CallParentRowsVisibleChanged()
{
   myDataGrid.ParentRowsVisibleChanged +=
      new EventHandler(DataGridParentRowsVisibleChanged_Clicked);
}

// Set the 'ParentRowsVisible' property on click of a button.
private void ToggleVisible_Clicked(object sender, EventArgs e)
{
   if (myDataGrid.ParentRowsVisible == true)
      myDataGrid.ParentRowsVisible = false;
   else
      myDataGrid.ParentRowsVisible = true;
}

// raise the event when 'ParentRowsVisible' property is changed.
private void DataGridParentRowsVisibleChanged_Clicked(object sender, EventArgs e)
{
   string myMessage = "ParentRowsVisibleChanged event raised, Parent row is : ";
   bool visible = myDataGrid.ParentRowsVisible;
   myMessage += (visible ? " " : " NOT ") + "visible";

   MessageBox.Show(myMessage, "ParentRowsVisible information");
}
private:
   void CallParentRowsVisibleChanged()
   {
      myDataGrid->ParentRowsVisibleChanged += gcnew EventHandler( this, &MyForm::DataGridParentRowsVisibleChanged_Clicked );
   }

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

   // raise the event when 'ParentRowsVisible' property is changed.
   void DataGridParentRowsVisibleChanged_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      String^ myMessage = "ParentRowsVisibleChanged event raised, Parent row is : ";
      bool visible = myDataGrid->ParentRowsVisible;
      myMessage = String::Concat( myMessage, visible ? (String^)" " : " NOT ", "visible" );
      MessageBox::Show( myMessage, "ParentRowsVisible information" );
   }
private void CallParentRowsVisibleChanged()
{
    myDataGrid.add_ParentRowsVisibleChanged(new 
        EventHandler(DataGridParentRowsVisibleChanged_Clicked));
} //CallParentRowsVisibleChanged

// Set the 'ParentRowsVisible' property on click of a button.
protected void ToggleVisible_Clicked(Object sender, EventArgs e)
{
    if (myDataGrid.get_ParentRowsVisible() == true) {
        myDataGrid.set_ParentRowsVisible(false);
    }
    else {
        myDataGrid.set_ParentRowsVisible(true);
    }
} //ToggleVisible_Clicked

// raise the event when 'ParentRowsVisible' property is changed.
protected void DataGridParentRowsVisibleChanged_Clicked(Object sender,
    EventArgs e) {
    String myMessage = "ParentRowsVisibleChanged event raised, "
        + "Parent row is : ";
    boolean visible = myDataGrid.get_ParentRowsVisible();
    myMessage +=(visible) ? " " : " NOT " + "visible";
    MessageBox.Show(myMessage, "ParentRowsVisible information");
} //DataGridParentRowsVisibleChanged_Clicked

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

DataGrid-Klasse
DataGrid-Member
System.Windows.Forms-Namespace