DataGridColumnStyle.MappingNameChanged 事件

MappingName 值更改时发生。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Event MappingNameChanged As EventHandler
用法
Dim instance As DataGridColumnStyle
Dim handler As EventHandler

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

/** @event */
public void remove_MappingNameChanged (EventHandler value)
JScript 支持使用事件,但不支持进行新的声明。

备注

有关处理事件的更多信息,请参见 使用事件

示例

Private Sub AddCustomColumnStyle()
   Dim myTableStyle As New DataGridTableStyle()
   myTableStyle.MappingName = "Orders"
   myColumnStyle = New DataGridTextBoxColumn()
   myColumnStyle.MappingName = "Orders"
   myColumnStyle.HeaderText = "Orders"
   myTableStyle.GridColumnStyles.Add(myColumnStyle)
   myDataGrid.TableStyles.Add(myTableStyle)
   AddHandler myColumnStyle.MappingNameChanged, AddressOf columnStyle_MappingNameChanged
   flag = True
End Sub 'AddCustomColumnStyle

' MappingNameChanged event handler of DataGridColumnStyle.
Private Sub columnStyle_MappingNameChanged(ByVal sender As Object, ByVal e As EventArgs)
   MessageBox.Show("Mapping Name changed")
End Sub 'columnStyle_MappingNameChanged
private void AddCustomColumnStyle()
{
   DataGridTableStyle myTableStyle = new DataGridTableStyle();
   myTableStyle.MappingName = "Orders";
   myColumnStyle =  new DataGridTextBoxColumn();
   myColumnStyle.MappingName="Orders";
   myColumnStyle.HeaderText="Orders";
   myTableStyle.GridColumnStyles.Add(myColumnStyle);
   myDataGrid.TableStyles.Add(myTableStyle);
   myColumnStyle.MappingNameChanged+=new EventHandler(columnStyle_MappingNameChanged);
   flag=true;
}
// MappingNameChanged event handler of DataGridColumnStyle.
private void columnStyle_MappingNameChanged(object sender, EventArgs e)
{
   MessageBox.Show("Mapping Name changed");
}
private:
   void AddCustomColumnStyle()
   {
      DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle;
      myTableStyle->MappingName = "Orders";
      myColumnStyle = gcnew DataGridTextBoxColumn;
      myColumnStyle->MappingName = "Orders";
      myColumnStyle->HeaderText = "Orders";
      myTableStyle->GridColumnStyles->Add( myColumnStyle );
      myDataGrid->TableStyles->Add( myTableStyle );
      myColumnStyle->MappingNameChanged += gcnew EventHandler( this, &MyForm::columnStyle_MappingNameChanged );
      flag = (bool *)true;
   }

   // MappingNameChanged event handler of DataGridColumnStyle.
   void columnStyle_MappingNameChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      MessageBox::Show( "Mapping Name changed" );
   }
private void AddCustomColumnStyle()
{
    DataGridTableStyle myTableStyle = new DataGridTableStyle();

    myTableStyle.set_MappingName("Orders");
    myColumnStyle = new DataGridTextBoxColumn();
    myColumnStyle.set_MappingName("Orders");
    myColumnStyle.set_HeaderText("Orders");
    myTableStyle.get_GridColumnStyles().Add(myColumnStyle);
    myDataGrid.get_TableStyles().Add(myTableStyle);
    myColumnStyle.add_MappingNameChanged(new EventHandler(
        columnStyle_MappingNameChanged));
    flag = true;
} //AddCustomColumnStyle

// MappingNameChanged event handler of DataGridColumnStyle.
private void columnStyle_MappingNameChanged(Object sender, EventArgs e)
{
    MessageBox.Show("Mapping Name changed");
} //columnStyle_MappingNameChanged

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

DataGridColumnStyle 类
DataGridColumnStyle 成员
System.Windows.Forms 命名空间