Khalid, your solution is fine if the column content is defined with DisplayMemberBinding, but it's not always the case : it could be defined with a CellTemplate instead...
I wrote a more flexible and reusable solution, based on attached properties :
http://tomlev2.wordpress.com/2009/03/27/wpf-automatically-sort-a-gridview-when-a-column-header-is-clicked/