由于您不想使用 3rd 方控件或自定义控件,因此穷人的解决方案很简单。
假设您的数据如下所示:
public class CustomData
{
public int Id { get; set; }
public string Type { get; set; }
public string Name { get; set; }
}
您可能向用户显示的内容可能是这样的:
List<CustomData> data = new List<CustomData>()
{
new CustomData { Id = 1, Name = "Test", Type = "Group1"},
new CustomData { Id = 2, Name = "Test", Type = "Group1"},
new CustomData { Id = 3, Name = "Test", Type = "Group1"},
new CustomData { Id = 4, Name = "Test", Type = "Group2"},
new CustomData { Id = 5, Name = "Test", Type = "Group2"},
new CustomData { Id = 6, Name = "Test", Type = "Group2"},
new CustomData { Id = 7, Name = "Test", Type = "Group3"},
new CustomData { Id = 8, Name = "Test", Type = "Group3"},
new CustomData { Id = 9, Name = "Test", Type = "Group3"},
};
var dataDisplayedToUser = data.GroupBy(g => g.Type).Select(p => p.Key);
在这种情况下将是:
Group1
Group2
Group3
当用户想要双击网格中的一行时,您可以向他们展示另一个具有以下数据子集的模态数据网格。
string dataValue = theGroupTheUserSelected // from your grid
var specificData = data.Where(f => f.Type == theGroupTheUserSelected);
您最终会向用户显示更少的数据,这更容易理解并且更容易理解。