Winform:
Add the following generation to the "endsorting" event of gridview1: 1 private void gridview1_endsorting (Object sender, eventargs E)
2 {
3 color CLR = gridview1.appearance. Row. backcolor;
4 foreach (devexpress. xtragrid. Columns. gridcolumn DC in gridview1.columns)
5 {
6 if (DC. visibleindex = gridview1.sortedcolumns [0]. visibleindex)
7 {
8 DC. appearancecell. backcolor = color. Red;
9}
10 else
11 {
12 DC. appearancecell. backcolor = CLR;
13}
14}
15}
Webfrom:
Add the following generations to the DataGrid sortcommand event:
1 foreach (datagridcolumn DGC in DG. columns)
2 {
3 if (DGC. sortexpression = E. sortexpression)
4 {
5 DGC. itemstyle. backcolor = color. Red;
6}
7 else
8 {
9 DGC. itemstyle. backcolor = color. White;
10}
11}
The DG is the real example of the DataGrid, and E is the data of the datagridsortcommandeventargs type imported by the sortcommand event.