I have a DataGridView (with WinForms) where I'm treating a particular row as a "child" of the row just before it. This means when a user sorts a column, that child row as to stay attached to the parent so it always appears just below it.
I'm overriding the SortCompare method to handle this, but I'm not sure just how to do it. Within SortCompare, I know if the row has a parent row, and if so what that row is. Therefore I want to be able to say, "if row1 has a parent, let the sort result be whatever it would be comparing row1's parent to row2". But how do I accomplish that without explicitly comparing the values myself (which I want to avoid so I don't have to keep track of the data types)? Is the comparer it's using available anywhere? Or is there just a better way to do what I'm trying to accomplish?