1

I am trying to sort column in My DatagridView in Silverlight

This is My class

    MyGrid.CanUserSortColumns = true;
    public class Row
    {
        private Dictionary<string, object> _data = new Dictionary<string, object>();
        public object this[string index]
        {
            get { return _data[index]; }
            set { _data[index] = value; }
        }
        public Dictionary<string, object> GetData()
        {
           return _data;
        }
   }

   ObservableCollection<Row> RowList = new ObservableCollection<Row>();

   foreach (string _Row in _DATA)
   {
       Row row = new Row();

       //some Data to add

       RowList.Add(row);
   }
}

PagedCollectionView RowListView = new PagedCollectionView(RowList);
this.MyGrid.ItemsSource = RowListView;

Still I cant Sort? What can I do ?

0

1 Answer 1

1

You need to set the CanUserSort="True" for each column of your datagrid in xaml. Definitely this will work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.