DataGridColumnStyle.ReadOnlyChanged 이벤트
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
ReadOnly 속성 값이 변경되면 발생합니다.
public:
event EventHandler ^ ReadOnlyChanged;
public event EventHandler ReadOnlyChanged;
member this.ReadOnlyChanged : EventHandler
Public Custom Event ReadOnlyChanged As EventHandler
이벤트 유형
예제
다음 코드 예제에서는이 멤버를 사용 하는 방법을 보여 줍니다.
private:
void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
if ( myButton->Text->Equals( "Make column read/write" ) )
{
myDataGridColumnStyle->ReadOnly = false;
myButton->Text = "Make column read only";
}
else
{
myDataGridColumnStyle->ReadOnly = true;
myButton->Text = "Make column read/write";
}
}
void AddCustomDataTableStyle()
{
myDataGridTableStyle = gcnew DataGridTableStyle;
myDataGridTableStyle->MappingName = "Customers";
myDataGridColumnStyle = gcnew DataGridTextBoxColumn;
myDataGridColumnStyle->MappingName = "CustName";
// Add EventHandler function for readonlychanged event.
myDataGridColumnStyle->ReadOnlyChanged += gcnew EventHandler( this, &MyForm1::myDataGridColumnStyle_ReadOnlyChanged );
myDataGridColumnStyle->HeaderText = "Customer";
myDataGridTableStyle->GridColumnStyles->Add( myDataGridColumnStyle );
// Add the 'DataGridTableStyle' instance to the 'DataGrid'.
myDataGrid->TableStyles->Add( myDataGridTableStyle );
}
void myDataGridColumnStyle_ReadOnlyChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
{
MessageBox::Show( "'Readonly' property is changed" );
}
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");
}
Private Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
If myButton.Text = "Make column read/write" Then
myDataGridColumnStyle.ReadOnly = False
myButton.Text = "Make column read only"
Else
myDataGridColumnStyle.ReadOnly = True
myButton.Text = "Make column read/write"
End If
End Sub
Private Sub AddCustomDataTableStyle()
myDataGridTableStyle = New DataGridTableStyle()
myDataGridTableStyle.MappingName = "Customers"
myDataGridColumnStyle = New DataGridTextBoxColumn()
myDataGridColumnStyle.MappingName = "CustName"
' Add EventHandler function for readonlychanged event.
AddHandler myDataGridColumnStyle.ReadOnlyChanged, AddressOf myDataGridColumnStyle_ReadOnlyChanged
myDataGridColumnStyle.HeaderText = "Customer"
myDataGridTableStyle.GridColumnStyles.Add(myDataGridColumnStyle)
' Add the 'DataGridTableStyle' instance to the 'DataGrid'.
myDataGrid.TableStyles.Add(myDataGridTableStyle)
End Sub
Private Sub myDataGridColumnStyle_ReadOnlyChanged(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("'Readonly' property is changed")
End Sub