Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
hierarchical datagrid Datasource vs DataItems
posted

Hi,

I am  using a Hierarchical datagrid to display data.

I dynamically populate the child records on record expanding event.

Also, I am manually describing the field layouts as well.

Now, when I assign the datasource property, the xamdatagrid *ignores* my field layouts and creates a new field layout based on the underlying data....

I made sure that AutoGenerateFields is set to false....

because of this sometimes my child records dont show up or display properly......and also my print functionality hangs and I get a stack overflow exception....

What is the difference between using datasource and dataitems collection?

Thanks for your valuable suggestions.

 

  • 69686
    posted

    Hello,

    The DataItems collections and the DataSource are almost the same thing. They both set the items in the XamDataGrid, however, they cannot be used at the same time - you can set the DataSource or add items in the DataItems.

    As you are creating a new FieldLayout, you have to explicitly set the AutoGenerateFields to false. However, it would be easier to create a new FieldLayout (auto generate) and handle the FieldLayoutInitialized event. The fields you will be generated automatically, and you can change settings on only the ones that you want.

    Furthermore, you can use the AssignFieldLayoutToItem event and set field layouts manually.