S StanB May 2, 2007 #1 Should DataGridView sort work if the datasource is an array? It works fine out of the box if bound to DataSet...
Should DataGridView sort work if the datasource is an array? It works fine out of the box if bound to DataSet...
T Tim Van Wassenhove May 3, 2007 #2 StanB schreef: Should DataGridView sort work if the datasource is an array? It works fine out of the box if bound to DataSet... Click to expand... You could wrap your array in a BindingList<T> that supports sorting... eg: http://www.timvw.be/presenting-the-sortablebindinglistt/
StanB schreef: Should DataGridView sort work if the datasource is an array? It works fine out of the box if bound to DataSet... Click to expand... You could wrap your array in a BindingList<T> that supports sorting... eg: http://www.timvw.be/presenting-the-sortablebindinglistt/
S StanB May 3, 2007 #3 It is so nice that you published the reusable class! I do get an error, though. It fails somewhere within your delegate, don't know where, because debugger doesn't step into the class. I only added a constructor to the class: public SortableBindingList(IList<T> list) : base(list) { } so I can initialize it from my array. That shouldn't cause the error, should it?
It is so nice that you published the reusable class! I do get an error, though. It fails somewhere within your delegate, don't know where, because debugger doesn't step into the class. I only added a constructor to the class: public SortableBindingList(IList<T> list) : base(list) { } so I can initialize it from my array. That shouldn't cause the error, should it?
S StanB May 4, 2007 #4 I had to change List<T> itemsList = this.Items as List<T>; to List<T> itemsList = new List<T>(Items); in order to fix that. Otherwise itesmList was null
I had to change List<T> itemsList = this.Items as List<T>; to List<T> itemsList = new List<T>(Items); in order to fix that. Otherwise itesmList was null
T Tim Van Wassenhove May 4, 2007 #5 StanB schreef: It is so nice that you published the reusable class! I do get an error, though. It fails somewhere within your delegate, don't know where, because debugger doesn't step into the class. I only added a constructor to the class: public SortableBindingList(IList<T> list) : base(list) { } so I can initialize it from my array. Click to expand... public SortableBindingList(IEnumerable<T> enumerable) { if (enumerable == null) { throw new ArgumentNullException("enumerable"); } foreach (T t in enumerable) { this.Add(t); } }
StanB schreef: It is so nice that you published the reusable class! I do get an error, though. It fails somewhere within your delegate, don't know where, because debugger doesn't step into the class. I only added a constructor to the class: public SortableBindingList(IList<T> list) : base(list) { } so I can initialize it from my array. Click to expand... public SortableBindingList(IEnumerable<T> enumerable) { if (enumerable == null) { throw new ArgumentNullException("enumerable"); } foreach (T t in enumerable) { this.Add(t); } }