This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
How can I move a column programmatically (same as dragging the heading with the mouse to change the order of the columns) ? I noticed the Columns and the EffectiveColumns collections ... now what? :-) EDIT: to give some context... I have a DataGrid and I need to add profiles to my program, that save the visible columns and their order to text files, and reloads them at the next startup. |
|
|
Hello Nestor The Columns collection is for developers to set up the custom column definitions. The EffectiveColumns collection is the actual collection of columns displayed by the DataGrid. You can programmatically reorder the columns by rearranging them in the EffectiveColumns collection. This collection is only populated when the DataGrid is loaded though, so you'll either need to run your logic after the DataGrid has been loaded, or attach a handler to the CollectionChanged event of the EffectiveColumns collection so you can order the columns as they are being added at load time. If you do this, make sure to avoid infinite recursive loops, and also remove this logic after the DataGrid is loaded. We hope to make this more convenient in a future version. Let me know if you have any troubles implementing this. Jason Fauchelle |
|