DataGridTableStyle.AllowSortingChanged イベントとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridTableStyle.AllowSortingChanged イベントの意味・解説 

DataGridTableStyle.AllowSortingChanged イベント

AllowSorting プロパティの値が変更され場合発生します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Event AllowSortingChanged As
 EventHandler
Dim instance As DataGridTableStyle
Dim handler As EventHandler

AddHandler instance.AllowSortingChanged, handler
public event EventHandler AllowSortingChanged
/** @event */
public void add_AllowSortingChanged (EventHandler
 value)

/** @event */
public void remove_AllowSortingChanged (EventHandler
 value)
JScript では、イベント使用できますが、新規に宣言することはできません。
解説解説
使用例使用例

ボタンクリックすることによって DataGrid 上で並べ替え実行できるようにし、現在の並べ替えの状態をラベル表示するコード例次に示します。この例は、データ格納する System.Data.DataSet を持つ DataGridButton、および Label が、Form 上にあることを前提としています。

Private Sub DataGridTableStyle_Sample_Load(ByVal
 sender As Object, _
                        ByVal e As EventArgs)
 Handles MyBase.Load
   myDataGridTableStyle1 = New DataGridTableStyle()

   mylabel.Text = "Sorting Status :" + myDataGridTableStyle1.AllowSorting.ToString()
   If myDataGridTableStyle1.AllowSorting = True
 Then
      btnApplyStyles.Text = "Remove Sorting"
   Else
      btnApplyStyles.Text = "Apply Sorting"
   End If
   ' Attach custom event handlers.
   AddHandler myDataGridTableStyle1.AllowSortingChanged, AddressOf
 AllowSortingChanged_Handler
   myDataGridTableStyle1.MappingName = "Customers"
End Sub 'DataGridTableStyle_Sample_Load

Private Sub AllowSortingChanged_Handler(ByVal
 sender As Object, ByVal
 e As EventArgs)
   mylabel.Text = "Sorting Status :" + myDataGridTableStyle1.AllowSorting.ToString()
End Sub 'AllowSortingChanged_Handler

Private Sub btnApplyStyles_Click(ByVal
 sender As Object, _
                                 ByVal e As
 EventArgs) Handles btnApplyStyles.Click
   If myDataGridTableStyle1.AllowSorting = True
 Then
      ' Remove sorting.
      myDataGridTableStyle1.AllowSorting = False
      btnApplyStyles.Text = "Allow Sorting"
   Else
      ' Allow sorting.
      myDataGridTableStyle1.AllowSorting = True
      btnApplyStyles.Text = "Remove Sorting"
   End If

   mylabel.Text = "Sorting Status :" + myDataGridTableStyle1.AllowSorting.ToString
   ' Add the DataGridTableStyle to DataGrid.
   myDataGrid.TableStyles.Add(myDataGridTableStyle1)
End Sub 'btnApplyStyles_Click
private void DataGridTableStyle_Sample_Load(object
 sender,
                                       EventArgs e)
{
   myDataGridTableStyle1 = new DataGridTableStyle();

   mylabel.Text = "Sorting Status :" + 
         myDataGridTableStyle1.AllowSorting.ToString();
   if(myDataGridTableStyle1.AllowSorting == true)
   {
      btnApplyStyles.Text = "Remove Sorting";
   }
   else
   {
      btnApplyStyles.Text = "Apply Sorting";
   }
   // Attach custom event handlers.
   myDataGridTableStyle1.AllowSortingChanged += 
               new System.EventHandler(AllowSortingChanged_Handler);
   myDataGridTableStyle1.MappingName = "Customers";
} 
private void AllowSortingChanged_Handler(object
 sender,EventArgs e)
{         
   mylabel.Text = "Sorting Status :" 
         + myDataGridTableStyle1.AllowSorting.ToString();
}     
private void btnApplyStyles_Click(object sender,
 EventArgs e)
{       

   if(myDataGridTableStyle1.AllowSorting == true)
   {            
      // Remove sorting.
      myDataGridTableStyle1.AllowSorting = false; 
      btnApplyStyles.Text = "Allow Sorting";
   }
   else
   {
      // Allow sorting.
      myDataGridTableStyle1.AllowSorting = true;
      btnApplyStyles.Text = "Remove Sorting";
   } 

   mylabel.Text = "Sorting Status :" + myDataGridTableStyle1.AllowSorting;
   // Add the DataGridTableStyle to DataGrid.
   myDataGrid.TableStyles.Add(myDataGridTableStyle1);
}
private:
   void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^
 /*e*/ )
   {
      myDataGridTableStyle1 = gcnew DataGridTableStyle;
      mylabel->Text = String::Concat( "Sorting Status : ", myDataGridTableStyle1->AllowSorting
 );
      if ( myDataGridTableStyle1->AllowSorting == true
 )
      {
         btnApplyStyles->Text = "Remove Sorting";
      }
      else
      {
         btnApplyStyles->Text = "Apply Sorting";
      }

      myDataGridTableStyle1->AllowSortingChanged += gcnew System::EventHandler(
         this, &DataGridTableStyle_Sample::AllowSortingChanged_Handler
 );
      myDataGridTableStyle1->MappingName = "Customers";
   }

   void AllowSortingChanged_Handler( Object^ /*sender*/, EventArgs^
 /*e*/ )
   {
      mylabel->Text = String::Concat( "Sorting Status : ", myDataGridTableStyle1->AllowSorting
 );
   }

   void btnApplyStyles_Click( Object^ /*sender*/, EventArgs^ /*e*/
 )
   {
      if ( myDataGridTableStyle1->AllowSorting == true
 )
      {
         // Remove sorting.
         myDataGridTableStyle1->AllowSorting = false;
         btnApplyStyles->Text = "Allow Sorting";
      }
      else
      {
         // Allow sorting.
         myDataGridTableStyle1->AllowSorting = true;
         btnApplyStyles->Text = "Remove Sorting";
      }

      mylabel->Text = String::Concat( "Sorting Status : ", myDataGridTableStyle1->AllowSorting
 );

      // Add the DataGridTableStyle to DataGrid.
      myDataGrid->TableStyles->Add( myDataGridTableStyle1 );
   }
private void DataGridTableStyleSampleLoad(Object
 sender, EventArgs e)
{
    myDataGridTableStyle1 = new DataGridTableStyle();
    mylabel.set_Text("Sorting Status :" 
        + System.Convert.ToString(myDataGridTableStyle1.get_AllowSorting()));
    if (myDataGridTableStyle1.get_AllowSorting() == true)
 {
        btnApplyStyles.set_Text("Remove Sorting");
    }
    else {
        btnApplyStyles.set_Text("Apply Sorting");
    }

    // Attach custom event handlers.
    myDataGridTableStyle1.add_AllowSortingChanged(
        new System.EventHandler(AllowSortingChanged_Handler));
    myDataGridTableStyle1.set_MappingName("Customers");
} //DataGridTableStyleSampleLoad

private void AllowSortingChanged_Handler(Object
 sender, EventArgs e)
{
    mylabel.set_Text("Sorting Status :" 
        + System.Convert.ToString(myDataGridTableStyle1.get_AllowSorting()));
} //AllowSortingChanged_Handler

private void btnApplyStyles_Click(Object sender,
 EventArgs e)
{
    if (myDataGridTableStyle1.get_AllowSorting() == true)
 {
        // Remove sorting.
        myDataGridTableStyle1.set_AllowSorting(false);
        btnApplyStyles.set_Text("Allow Sorting");
    }
    else {
        // Allow sorting.
        myDataGridTableStyle1.set_AllowSorting(true);
        btnApplyStyles.set_Text("Remove Sorting");
    }
    mylabel.set_Text("Sorting Status :" 
        + ((myDataGridTableStyle1.get_AllowSorting()) ? "True" : "False"));
    // Add the DataGridTableStyle to DataGrid.
    myDataGrid.get_TableStyles().Add(myDataGridTableStyle1);
} //btnApplyStyles_Click
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

DataGridTableStyle.AllowSortingChanged イベントのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridTableStyle.AllowSortingChanged イベントのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS