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
331
Column headers not shown when binding empty list and dynamically creating field layout
posted

I am creating a fieldlayout dynamically by handling the FieldLayoutInitialized event and adding unbound fields to the fieldlayout present in the event args.  When this is done, it seems that although this event handler is called and fields are added, the field headers don't show up in the UI when there are no elements in the collection that represents the DataSource.  I can tell that fields are getting set because summary rows are present for each field I have created.  When the collection is populated with at least one object, field headers are rendered.

FYI I am depending on the XamDataGrid to invoke the FieldLayoutInitialized event when I do the following:

 grid.ResetFieldLayouts();

grid.DataSource = null;

grid.SetBinding(XamDataGrid.DataSourceProperty, "DataSourceBindingPathHere"

I have noted that column headers do seem to be displayed when I define the fieldlayouts completely in XAML - even when there are no elements in the underlying DataSource collection.  What am I missing to get Field Headers to display when dynamically creating columns?

Parents
  • 69686
    posted

    Hello,

    I am not completely sure if this is supposed to work, when you set the DataSource to null, but the headers should appear if you set the data source to an empty list, like this:

    grid.DataSource = new List<MyClass>();

Reply Children
No Data