DevExpress WPF GridControl with Dynamic Columns and Rows

I am working with DevExpress 14.1 GridControl in WPF, which needs to bind to a dynamic source. We don't know the number of columns or rows at design time, so this needs to be calculated on the fly.

Source can be changed on runtime, adding more rows or columns, or BOTH (I can have a table with 3 columns and 5 rows, and the 6th row with 4 columns can be inserted by adding a new column to the model with empty data for the previous lines).

I used a DataTable as the ItemSource for the grid, but it will only load data inserted at design time. If I add columns when the app starts, the grid won't refresh for some reason.

Is there an observable that can satisfy these needs?

+3


source to share


1 answer


It uses code-behind (not MVVM) and you may have tried it already, but have I tried explicitly naming it myGrid.RefreshData()

in your .xaml.cs file? There will be several connections to make them ring at the right time depending on your data changes, but it might help you, if it helps you, help you fix the problem.

DevExpress support answer here might also help.



Going from DataTable to ObservableCollection can do the trick too: see this .

BTW, I found the DevExpress support system very helpful; they seem to respond within ~ 24 hours to queries and questions. If you can still get support for your license and cannot resolve it, I would ask them the same question here .

0


source







All Articles