DataGridColumnStyle.PropertyDescriptorChanged 이벤트
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
PropertyDescriptor 속성 값이 변경되면 발생합니다.
public:
event EventHandler ^ PropertyDescriptorChanged;
[System.ComponentModel.Browsable(false)]
public event EventHandler PropertyDescriptorChanged;
[<System.ComponentModel.Browsable(false)>]
member this.PropertyDescriptorChanged : EventHandler
Public Custom Event PropertyDescriptorChanged As EventHandler
이벤트 유형
- 특성
예제
다음 코드 예제에서는이 멤버를 사용 하는 방법을 보여 줍니다.
private:
void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
if ( TablesAlreadyAdded )
{
return;
}
AddCustomDataTableStyle();
}
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 column.
PropertyDescriptor^ myPropertyDescriptor = myCurrencyManager->GetItemProperties()[ "Amount" ];
// Construct a 'DataGridColumnStyle' object changing its format to 'Currency'.
DataGridColumnStyle^ myColumnStyle = gcnew DataGridTextBoxColumn( myPropertyDescriptor,"c",true );
// Add EventHandler function for PropertyDescriptorChanged Event.
myColumnStyle->PropertyDescriptorChanged += gcnew System::EventHandler( this, &myDataForm::MyPropertyDescriptor_Changed );
myTableStyle->GridColumnStyles->Add( myColumnStyle );
// Add the DataGridTableStyle instance to the GridTableStylesCollection.
myDataGrid->TableStyles->Add( myTableStyle );
TablesAlreadyAdded = true;
}
void MyPropertyDescriptor_Changed( Object^ /*sender*/, EventArgs^ /*e*/ )
{
myLabel->Text = "Property Descriptor Property of DataGridColumnStyle has changed";
}
private void myButton_Click(object sender, EventArgs e)
{
if(TablesAlreadyAdded)
{
return;
}
AddCustomDataTableStyle();
}
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 column.
PropertyDescriptor myPropertyDescriptor = myCurrencyManager.GetItemProperties()["Amount"];
// Construct a 'DataGridColumnStyle' object changing its format to 'Currency'.
DataGridColumnStyle myColumnStyle = new DataGridTextBoxColumn(myPropertyDescriptor,"c",true);
// Add EventHandler function for PropertyDescriptorChanged Event.
myColumnStyle.PropertyDescriptorChanged+=new System.EventHandler(MyPropertyDescriptor_Changed);
myTableStyle.GridColumnStyles.Add(myColumnStyle);
// Add the DataGridTableStyle instance to the GridTableStylesCollection.
myDataGrid.TableStyles.Add(myTableStyle);
TablesAlreadyAdded=true;
}
private void MyPropertyDescriptor_Changed(object sender,EventArgs e)
{
myLabel.Text="Property Descriptor Property of DataGridColumnStyle has changed";
}
Private Sub myButton_Click(ByVal sender As Object, ByVal e As EventArgs)
If TablesAlreadyAdded Then
Return
End If
AddCustomDataTableStyle()
End Sub
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 column.
Dim myPropertyDescriptor As PropertyDescriptor = myCurrencyManager.GetItemProperties()("Amount")
' Construct a 'DataGridColumnStyle' object changing its format to 'Currency'.
Dim myColumnStyle As DataGridTextBoxColumn = New DataGridTextBoxColumn(myPropertyDescriptor, "c", True)
' Add EventHandler function for PropertyDescriptorChanged Event.
AddHandler myColumnStyle.PropertyDescriptorChanged, AddressOf MyPropertyDescriptor_Changed
myTableStyle.GridColumnStyles.Add(myColumnStyle)
' Add the DataGridTableStyle instance to the GridTableStylesCollection.
myDataGrid.TableStyles.Add(myTableStyle)
TablesAlreadyAdded = True
End Sub
Private Sub MyPropertyDescriptor_Changed(ByVal sender As Object, ByVal e As EventArgs)
myLabel.Text = "Property Descriptor Property of DataGridColumnStyle has changed"
End Sub