DevExpress isn't part of .NET. You should really post in their support forum as how they implement sorting isn't necessarily how .NET does it.
In Winform's version of DataGridView you can use the Sort method. This method has an overload taking an IComparer implementation which can sort by whatever you want. In fact that link to the Sort
method has sample code doing exactly what you want. It sorts by column A and then B if column A are equal. That is what you'd do as well. Note that the sample implementation also takes into account whether you're ascending or descending sorting which is something you need to handle as well. Therefore I'd recommend you start with that example and adjust for your specific column sorting.