I have a XamDataGrid (12.2 WPF) and AllowAddNew="True" which works fine. Now my DataItems have a sub-collection that can be shown and expanded by clicking on the small symbol left to the rows. Perfect. I can also add new items to this sub-collection but only as long as there is already at least one element in it.
AllowAddNew="True"
If there is no element in the subcollection, clicking on the "open-and-show-sub-collection" icon makes this icon just disappearing - no empty list and no AddNewElement-Row is shown!
How can i allow my customers to add new elements in an empty sub-collection??
<igWPF:XamDataGrid DataSource="{Binding ...}"> <igWPF:XamDataGrid.FieldLayoutSettings> <igWPF:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="True"/> </igWPF:XamDataGrid.FieldLayoutSettings> <igWPF:XamDataGrid.FieldLayouts> <igWPF:FieldLayout> <igWPF:FieldLayout.Fields > <igWPF:Field Name="Title"/> ... <igWPF:Field Name="CollectionOfSubitems"/> </igWPF:FieldLayout.Fields> </igWPF:FieldLayout> <igWPF:FieldLayout Key="TypeOfSubitems"> <igWPF:FieldLayout.Fields > <igWPF:Field Name="Id" Visibility="Collapsed"/> <igWPF:Field Name="Title" /> ... </igWPF:FieldLayout.Fields> </igWPF:FieldLayout> </igWPF:XamDataGrid.FieldLayouts></igWPF:XamDataGrid>
I can add new elements to the collection. I cannot add elements of type TypeOfSubitems to the CollectionOfSubitems as long as this CollectionOfSubitems is empty!
Hello,
Thank you for your post.
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post and into the issue with ID 181571. I tested this behavior with the RTM version and the latest Service Release of Infragistics controls for 15.1 and 15.2 and it works fine on my side. If it is still an issue for you, would you please provide me with more details about the specific version of Infragistics assemblies that you are using? It would be great if you could provide me with short sample project that illustrate your issue. Having this I can further investigate this behavior for you.
Please do not hesitate to let me know if you have any further questions on this matter.
If it was fixed then, so version 15.1 should have it as well - at least I think so.
I am using 15.1 and still have the described issue.
Would you please take a look at it again.
Thanks
Victor
Hello Martin,
We have shipped out a new service release where your issue is resolved. I'd be glad to find out if you had tested it out and if it had met your requirements.
You can download the Service Releases by logging to our web site and going to Account\My Keys and Downloads.
I have logged this behavior with our developers in our tracking system, with an issue ID of 181571. I have also created a support ticket on your behalf with number CAS-144122-N8B7D2 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.
Thanks yanko for your idea. My problem is that i cannot change the behavior of my DataSource (i.e. i cannot guarantee that i allways have my dummy-elenent in the collection).
So I tried to add an element like this
private void DataPresenterBase_OnRecordExpanding(object sender, RecordExpandingEventArgs e){ var record = ((e.Record as DataRecord).DataItem as MyRecordType); if (!record.SubCollection.Any()) record.NutzflaechenItems.Add(new SubCollectionItem());}
While this works, it is annoying that i have to use an ObservableCollection (otherwise i don't need to push changes from code to UI). And it is also annoying that the customer wants to add a first item and there is always an empty item in the list. He/she won't understand why sometimes there is no element and sometimes there is a dummy element...
Well... this is a workaround that i may use, but it is not really satisfying... No other possible way?