Windows Develop Bookmark and Share   
 index > Windows Forms Designer > How to add Sort Icon to Gridview Header?
 

How to add Sort Icon to Gridview Header?

How to add Sort Icon to Gridview Header in windows aplication?
Ganapatisb  Tuesday, September 01, 2009 11:09 AM
Hi

We can set the SortMode and HeaderCell.SortGlyphDirection properties to show the sort icon. This is the details and a sample:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumnheadercell.sortglyphdirection.aspx.

If you want to show a custom icon, you need to handle the CellPainting event of the DataGridView to draw the icon programmatically. This thread shows the details:
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/74959006-7a8a-4487-ab54-f2aac2bf7196.

Regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Thursday, September 03, 2009 9:50 AM
Hi

We can set the SortMode and HeaderCell.SortGlyphDirection properties to show the sort icon. This is the details and a sample:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumnheadercell.sortglyphdirection.aspx.

If you want to show a custom icon, you need to handle the CellPainting event of the DataGridView to draw the icon programmatically. This thread shows the details:
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/74959006-7a8a-4487-ab54-f2aac2bf7196.

Regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Thursday, September 03, 2009 9:50 AM

You can use google to search for other answers

Custom Search

More Threads

• Outlook Address Card View
• Auto change parent in design-time
• Progress Bar Designer defaults vs Design Time Settings ... Possible Conflict
• Can you override the position of the TabOrder indicator?
• Can't understand this exception at design-time (C# express 2005)
• how to active mouse right click function?
• How to maintain linked values in Designer
• Form base with a BindingSource - problem
• Designer repeatedly adds all columns from datasource to datagridview.
• Button moves in Child Forms