I am loading a grid with 16 columns. But before i print the grid i want to change the fieldlayout so that there are 8 columns on first row and remaining 8 cols in second row.
eg:
col1 col2 ..... col8col9 col10 col11...... col16
I am trying to achieve this by changing FieldLayout but i am unable to do so.
I have tried creating a new fieldlayout and changing Fields[].Row and Column value as per my need with proper span and adding the new layout to XamDataGrid.FieldLayouts.Add(new_layout) and then making the layout default i.e. XamDataGrid.DefaultFieldLayout=XamDataGrid.FieldLayouts[1];
I even tried changing XamDataGrid.DefaultFieldLayout directly but nothing worked for me.
Can anyone pls let me know what my problem is??
Thanksmiztaken
Hi miztaken,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.
Hi Stefan,
Sorry for late response. But yes, finally the XamDataPresenter worked for me.
My requirement was to change the RowLayout/Field setting dynamically or at runtime once the grid/presenter is already loaded with a datasource like for printing, not define the initial layout.
So, the only solution i can come up with was reload the Datasource in newlayout and change the layout in event AssigningFieldLayoutToItem method.
i.e. I have following code in my AssigningFieldLayoutToItem event.
if (bPrintLayout) e.FieldLayout = xamPresenter.FieldLayouts[1];else e.FieldLayout = xamPresenter.FieldLayouts[0];
And whenever the print button is hit i just reload the data source.
I Hope this helps. Thanks for the support.
miztaken