【发布时间】:2011-02-22 12:48:07
【问题描述】:
我有一个自定义的DataGridView 单元格用于显示MyType 对象的内容。为了控制它们的格式,我覆盖了DataGridViewTextBoxCell 的GetFormattedValue() 和FormattedvalueType 方法,因为在这种情况下我不想使用默认的ToString() 方法。问题是,当我这样做时,DataGridView 是按FormattedValue 中的字符串而不是Value 对列进行排序。
我没有看到可以重写以更改列的排序行为的方法。虽然我知道我可以,但我不想编写自定义的DataGridView.Sort() 方法,因为我在多个DataGridViews 中使用MyType 列。
【问题讨论】:
标签: c# .net winforms .net-3.5 datagridview