Есть ли способ сортировки WPF DataGrid programmaticaly (например, как если бы я нажал на мой первый столбец).
Есть ли способ имитировать этот клик? Или лучший способ?
Вот мой код:
Collection_Evenements = new ObservableCollection<Evenement>();
Collection_Evenements = myEvenement.GetEvenementsForCliCode(App.obj_myClient.m_strCode);
Collection_Evenements.CollectionChanged += Collection_Evenements_CollectionChanged;
myDataGridEvenements.ItemsSource = Collection_Evenements;
System.Data.DataView dv = (System.Data.DataView)myDataGridEvenements.ItemsSource;
dv.Sort = "strEvtType";
myDataGridEvenements.Focus();
myDataGridEvenements.SelectedIndex = 0;
myDataGridEvenements.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
Я не знаю почему, но строка "dv.Sort =" strEvtType ";" вызывают странную вещь, мой Window Show и программа не продолжают выполнять следующие строки, тем не менее я не вижу сортировку!
Большое спасибо,
С уважением,
Nixeus