本文整理匯總了C#中System.Windows.Forms.DataGridTableStyle.AllowSorting屬性的典型用法代碼示例。如果您正苦於以下問題:C# DataGridTableStyle.AllowSorting屬性的具體用法?C# DataGridTableStyle.AllowSorting怎麽用?C# DataGridTableStyle.AllowSorting使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Windows.Forms.DataGridTableStyle
的用法示例。
在下文中一共展示了DataGridTableStyle.AllowSorting屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DataGridTableStyle_Sample_Load
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);
}