DataGridColumnStyle.HeaderTextChanged 이벤트
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
HeaderText 속성 값이 변경되면 발생합니다.
public:
event EventHandler ^ HeaderTextChanged;
public event EventHandler HeaderTextChanged;
member this.HeaderTextChanged : EventHandler
Public Custom Event HeaderTextChanged As EventHandler
이벤트 유형
예제
다음 코드 예제에서는이 멤버를 사용 하는 방법을 보여 줍니다.
private:
void AddCustomDataTableStyle()
{
DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle;
// Map DataGridTableStyle to a DataTable.
myTableStyle->MappingName = "Orders";
// Get CurrencyManager Object*.
CurrencyManager^ myCurrencyManager = dynamic_cast<CurrencyManager^>(BindingContext[myDataSet, "Orders"]);
// Use the CurrencyManager to get the PropertyDescriptor for the column.
PropertyDescriptor^ myPropertyDescriptor = myCurrencyManager->GetItemProperties()[ "Amount" ];
// Change the HeaderText.
DataGridColumnStyle^ myColumnStyle = gcnew DataGridTextBoxColumn( myPropertyDescriptor,"c",true );
// Attach a event handler function with the 'HeaderTextChanged' event.
myColumnStyle->HeaderTextChanged += gcnew EventHandler( this, &myDataForm::MyHeaderText_Changed );
myColumnStyle->Width = 130;
myColumnStyle->HeaderText = "Amount in $";
myTableStyle->GridColumnStyles->Add( myColumnStyle );
myDataGrid->TableStyles->Add( myTableStyle );
TablesAlreadyAdded = (bool *)true;
}
void MyHeaderText_Changed( Object^ /*sender*/, EventArgs^ /*e*/ )
{
myLabel->Text = "Header Descriptor Property of DataGridColumnStyle has changed";
}
private void AddCustomDataTableStyle()
{
DataGridTableStyle myTableStyle = new DataGridTableStyle();
// Map DataGridTableStyle to a DataTable.
myTableStyle.MappingName = "Orders";
// Get CurrencyManager object.
CurrencyManager myCurrencyManager = (CurrencyManager)BindingContext[myDataSet,"Orders"];
// Use the CurrencyManager to get the PropertyDescriptor for the column.
PropertyDescriptor myPropertyDescriptor = myCurrencyManager.GetItemProperties()["Amount"];
// Change the HeaderText.
DataGridColumnStyle myColumnStyle = new DataGridTextBoxColumn(myPropertyDescriptor,"c",true);
// Attach a event handler function with the 'HeaderTextChanged' event.
myColumnStyle.HeaderTextChanged+=new EventHandler(MyHeaderText_Changed);
myColumnStyle.Width=130;
myColumnStyle.HeaderText="Amount in $";
myTableStyle.GridColumnStyles.Add(myColumnStyle);
myDataGrid.TableStyles.Add(myTableStyle);
TablesAlreadyAdded=true;
}
private void MyHeaderText_Changed(object sender,EventArgs e)
{
myLabel.Text="Header Descriptor Property of DataGridColumnStyle has changed";
}
Private Sub AddCustomDataTableStyle()
Dim myTableStyle As New DataGridTableStyle()
' Map DataGridTableStyle to a DataTable.
myTableStyle.MappingName = "Orders"
' Get CurrencyManager object.
Dim myCurrencyManager As CurrencyManager = CType(BindingContext(myDataSet, "Orders"), CurrencyManager)
' Use the CurrencyManager to get the PropertyDescriptor for the column.
Dim myPropertyDescriptor As PropertyDescriptor = myCurrencyManager.GetItemProperties()("Amount")
' Change the HeaderText.
Dim myColumnStyle As DataGridTextBoxColumn = New DataGridTextBoxColumn(myPropertyDescriptor, "c", True)
' Attach a event handler function with the 'HeaderTextChanged' event.
AddHandler myColumnStyle.HeaderTextChanged, AddressOf MyHeaderText_Changed
myColumnStyle.Width = 130
myColumnStyle.HeaderText = "Amount in $"
myTableStyle.GridColumnStyles.Add(myColumnStyle)
myDataGrid.TableStyles.Add(myTableStyle)
TablesAlreadyAdded = True
End Sub
Private Sub MyHeaderText_Changed(ByVal sender As Object, ByVal e As EventArgs)
myLabel.Text = "Header Descriptor Property of DataGridColumnStyle has changed"
End Sub