DataGridColumnStyle.ReadOnlyChanged Evento

Definizione

Si verifica quando il valore della proprietà ReadOnly cambia.

C#
public event EventHandler ReadOnlyChanged;

Tipo evento

Esempio

Nell'esempio di codice seguente viene illustrato l'uso di questo membro.

C#
private void Button_Click(Object sender, EventArgs e)
{ 
   if (myButton.Text == "Make column read/write")
   {
      myDataGridColumnStyle.ReadOnly = false;
      myButton.Text = "Make column read only";
   }
   else
   {
      myDataGridColumnStyle.ReadOnly = true;
      myButton.Text = "Make column read/write";
   }
}

private void AddCustomDataTableStyle()
{
   myDataGridTableStyle = new DataGridTableStyle();
   myDataGridTableStyle.MappingName = "Customers";
   myDataGridColumnStyle = new DataGridTextBoxColumn();
   myDataGridColumnStyle.MappingName= "CustName";
   // Add EventHandler function for readonlychanged event.
   myDataGridColumnStyle.ReadOnlyChanged += new EventHandler(myDataGridColumnStyle_ReadOnlyChanged);
   myDataGridColumnStyle.HeaderText = "Customer";
   myDataGridTableStyle.GridColumnStyles.Add(myDataGridColumnStyle);
   // Add the 'DataGridTableStyle' instance to the 'DataGrid'.
   myDataGrid.TableStyles.Add(myDataGridTableStyle);
}
private void myDataGridColumnStyle_ReadOnlyChanged(Object sender, EventArgs e)
{
   MessageBox.Show("'Readonly' property is changed");
}

Si applica a

Prodotto Versioni
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0