0

I would like to sort some objects that have a Name property. These objects are stored in CollectionViewSource. I add sorting description in the following way:

MyCollectionViewSource.View.SortDescriptions.Add(new SortDescription("Name"),direction));

where direction is Ascending/Descending. Everything works fine except one case. In Danish alphabet when I use for instance name: Aarhus or Aabenra it should be after "Z". So when I have the following names: Silkeborg, Aarhus, Aabenraa, Odense it should be sorted as follows:

  • Odense Silkeborg Aabenraa Aarhus

however, currently it sorted as follows:

  • Aabenraa Aarhus Odense Silkeborg

I tried to change culture info before each sorting but it doesn't work. SQL Server 2005 sort these values correct.

skaffman
  • 398,947
  • 96
  • 818
  • 769
niao
  • 4,972
  • 19
  • 66
  • 114

1 Answers1

0

I resolved the problem. I set appropriate CultureInfo in MyCollectionViewSource.Culture property:

MyCollectionViewSource.Culture = CultureInfo.CurrentCulture
niao
  • 4,972
  • 19
  • 66
  • 114