Hello,
I think I have a very simple question but I can't find a solution for this.
How can I still show the header (FieldLayouts & a filled in Group By Area) of the XamDataGrid even when XamDataGrid is bound to an empty list?
XamDataGrid only shows the "Group by" area but also with no items in there.
So I want to show the header and a filled in "Group By" header even when there are no items in the list?
Thanks,Bert Janssens
I thought I've found the solution:
<igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings ExpandableFieldRecordHeaderDisplayMode="AlwaysDisplayHeader" /> </igDP:XamDataGrid.FieldSettings>
but this doesn't work, can anybody help me with this?
Unfortunately, I don't know the answer to your initial question. However, the reason your XAML fails to display the headers is becuase the ExpandableFieldRecordHeader and the groupby header are two different beasts.
The ExpandandleFieldRecordHeader is the header that appears when a particular data item in your data source has a child collection of items and you'd like to display it in the grid. This is different from the group by header, which is used for custom group by scenarios.
Hope this helps a bit .
-Szymon
Hi,
Sorry for the delayed response. I tested this out with the v8.1 XamDataGrid, and it showed the field headers and groupby headers when I set the grid's DataSource like this:
this.xamDG.DataSource = new Uri[0];
Perhaps I don't understand what you are trying to achieve. Please let me know if I'm missing anything here.
Thanks,
Josh
Hmmm... I have suffered through the reported behavior, as well. In fact, I got around it by showing/hiding elements based on the data source containing data.
In fact, I just implemented a search box this morning, and if I filter out all data, the headers disappear.
Perhaps this only happens when auto-gen fields is disabled.
I need also it.
Thanks
There is a bug in the xamdatagrid where if you only have collections and all the collections are empty it wont show the collection headers. However, if even one collection is not empty it will show all the headers if the ExpandableFieldRecordHeaderDisplayMode is set to AlwaysDisplayHeader. So to override the bug add a dummy collection to your data object which has a non empty collection and set the browsable attribute to false so it wont show up in the xamdatagrid. I use the following
private readonly BindingList<string> DummyForXamDataGridBackingField ;
public dataobject(){ string dummycollectionitem = "This is here to force the xamdatagrid to show the headers in the other browsable collections"; DummyForXamDataGridBackingField = new ThreadedBindingList<string> { dummycollectionitem };
}
[Browsable(false)]public ThreadedBindingList<string> DummyForXamDataGrid{ get { return DummyForXamDataGridBackingField; }}
works like a charm.
Thank you for posting your solution. I'm having some difficulty, however, implementing it. I'm not 100% sure I have interpreted this correctly, but I have achieved something resembling the result you described. The result, however, has some unfortunate ramifications, which I'll explain in a few paragraphs. For clarification, my implementation included the following aspects:
With this implementation, I now seem to get a result where the column headers do not go away with an empty collection, but I get a grid which has a few unfortunate features:
My primary meaning is not to nit-pick your workaround but rather to ask whether this was indeed the result you obtained. I tried several other permutations interpreting your solution including the following:
Any insights would be appreciated.
Just to add info for topics maybe it helps someone.
So...
I have a next issue:
1. Base class Class1 with fields X, Y
2. Extended class Class2 : Class1 with additional field Z
3. ObservableCollection<Class1>
4. XamDataGrid with FieldLayouts for X,Y,Z.
What have I seen:
When no data in collection there is no header in grid.
After adding some values of type Class2, data existed also with a proper header.
What helps me with no data in collection:
change collection to ObservableCollection<Class2>
Is there any valid solution to this problem?
VJ