views:

7

answers:

1

Hello, 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.

A: 

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

MyCollectionViewSource.Culture = CultureInfo.CurrentCulture
niao