本文整理汇总了C#中System.Windows.Forms.DataGridViewRow.Where方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewRow.Where方法的具体用法?C# DataGridViewRow.Where怎么用?C# DataGridViewRow.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridViewRow
的用法示例。
在下文中一共展示了DataGridViewRow.Where方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _UpdateFilters
private void _UpdateFilters()
{
if (ModList == null) return;
// Each time a row in DataGridViewRow is changed, DataGridViewRow updates the view. Which is slow.
// To make the filtering process faster, Copy the list of rows. Filter out the hidden and replace t
// rows in DataGridView.
var rows = new DataGridViewRow[mainModList.full_list_of_mod_rows.Count];
mainModList.full_list_of_mod_rows.CopyTo(rows, 0);
// Try to remember the current scroll position and selected mod
var scroll_col = Math.Max(0, ModList.FirstDisplayedScrollingColumnIndex);
GUIMod selected_mod = null;
if (ModList.CurrentRow != null)
{
selected_mod = (GUIMod) ModList.CurrentRow.Tag;
}
ModList.Rows.Clear();
foreach (var row in rows)
{
var mod = ((GUIMod) row.Tag);
row.Visible = mainModList.IsVisible(mod);
}
var sorted = this._SortRowsByColumn(rows.Where(row => row.Visible));
ModList.Rows.AddRange(sorted.ToArray());
// Find and select the previously selected row
if (selected_mod != null)
{
var selected_row = ModList.Rows.Cast<DataGridViewRow>()
.FirstOrDefault(row => selected_mod.Identifier.Equals(((GUIMod)row.Tag).Identifier));
if (selected_row != null)
{
ModList.CurrentCell = selected_row.Cells[scroll_col];
}
}
}