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
Hello miztaken,
Thank you for your post. I have been looking through it and I suggest you re-arrange your fields in your XamDataGrid by using their Row and Column properties. One possible way is to implement this functionality in code behind just before you print the grid. Here is explained, in details, about fields positioning:
http://help.infragistics.com/NetAdvantage/WPF/2011.1/CLR4.0/?page=xamDataGrid_Changing_the_Default_Column_and_Row_Definitions.html
Please let me know if this is what you are trying to achieve or you need any further clarifications on this matter.
Looking forward for your reply.
Hi Stefan,
Thanks for the info. I can now change my FieldSettings to multiple rows now but i still cant do it on the fly.
I want to change the fieldlayouts just before i print the grid. Here is what i have done.
I have created two fieldlayouts in xaml file one layout is basic layout on which the data will be displayed on the grid (layout of index 0) and the other is the layout i want the data to be printed on (layout of index 1).
I am trying to change the default layout of the datapresenter when user wants to print it by doing this:-
xamPresenter.DefaultFieldLayout = xamPresenter.FieldLayouts[1];
And after printing i am changing it back to
xamPresenter.DefaultFieldLayout = xamPresenter.FieldLayouts[0];
But it is not working.
When i initially load the grid, if i select FieldLayout[1] then it displays in that layout. However, when i disaply the grid initially in layout[0] and the try to change it then it doesnt work.
After few reading it seems like we need to make use of AssigningFieldLayoutToItem Event. But i was wondering how to fire this event when datasource is not updated.
help me understand this