Hi -
I am testing use of the xamGrid with WCF RIA services. I have a couple of easy questions that I hoped someone could help with:
1) I am trying to utilize the functionality in xamGrid to create new records inline. I was able to set the AllowAddNewRow property and see the capability in the GUI. However, it doesn't seem to submit back to the domaindatasource? Do I need to manually do this? What are best practices in terms of where? In the rowadded event handler? How about for inline edit/delete?
2) I can't seem to edit existing data in the grid out-of-the-box. I've looked through the properties and didn't see anything special I needed to set to enable? What do I need to do here to enable?
BTW, the documentation seems pretty slim for the xamGrid. Maybe I am looking in the wrong place (help docs for silverlight 10.3) and someone can direct me elsewhere?
Thanks!
Hello,
Just checking if the latest reply helped you out and if you require any further assistance on the matter.
Sincerely,DimiDeveloper Support Engineer, MCPD Infragistics, Inc.www.infragistics.com/support
I'm having the same problem.
Here is my code (svc is my RIA service):
private void LoadData() { svc.Load(svc.GetActiveMedicalWeightRecordsQuery(), result => { dgWeight.ItemsSource = svc.MedicalWeightRecords; }, null); }
HERE IS my xaml
<igGrid:XamGrid HorizontalAlignment="Left" Name="dgWeight" VerticalAlignment="Top" AutoGenerateColumns="False" IsAlternateRowsEnabled="True" IsEnabled="False" ColumnWidth="*"> <igGrid:XamGrid.AddNewRowSettings> <igGrid:AddNewRowSettings AllowAddNewRow="Top" IsMouseActionEditingEnabled="SingleClick" ></igGrid:AddNewRowSettings> </igGrid:XamGrid.AddNewRowSettings> <igGrid:XamGrid.EditingSettings> <igGrid:EditingSettings AllowEditing="Row" /> </igGrid:XamGrid.EditingSettings> <igGrid:XamGrid.SummaryRowSettings> <igGrid:SummaryRowSettings AllowSummaryRow="None" /> </igGrid:XamGrid.SummaryRowSettings> <igGrid:XamGrid.Columns> <igGrid:TemplateColumn Key="DateRecorded" HeaderText="Date Recorded"> <igGrid:TemplateColumn.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding DateRecorded, Mode=TwoWay}"></TextBlock> </DataTemplate> </igGrid:TemplateColumn.ItemTemplate> <igGrid:TemplateColumn.EditorTemplate> <DataTemplate> <sdk:DatePicker SelectedDate="{Binding DateRecorded, Mode=TwoWay}" /> </DataTemplate> </igGrid:TemplateColumn.EditorTemplate> </igGrid:TemplateColumn> <igGrid:TemplateColumn Key="Weight"> <igGrid:TemplateColumn.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Weight, Mode=TwoWay}"></TextBlock> </DataTemplate> </igGrid:TemplateColumn.ItemTemplate> <igGrid:TemplateColumn.EditorTemplate> <DataTemplate> <TextBox Text="{Binding Weight, Mode=TwoWay}"></TextBox> </DataTemplate> </igGrid:TemplateColumn.EditorTemplate> </igGrid:TemplateColumn> </igGrid:XamGrid.Columns> </igGrid:XamGrid>
If I change
dgWeight.ItemsSource = svc.MedicalWeightRecords;
to
dgWeight.ItemsSource = svc.MedicalWeightRecords.ToList();
then I am able to add a row to the grid visually at least, but it doesn't get committed back to svc.MedicalWeightRecords.
With regard to the AddNewRow functionality of the grid it is only required to bind the itemsource to an object that implements IList interface. If you need to commit any changes made to the datasource than you will have to use the SubmitChanges method of the DomainDataSource. The RowAdded event is a good place to execute this method.
I'm facing to the problem if I assign itemsource from code the grid can't perform action of adding or deleting the system will throw exception.
My code:
_eBiz4DSys = new eBiz4DSysContext();
this.xamGrid1.ItemsSource = _eBiz4DSys.SYS_Screens;
_eBiz4DSys.Load(_eBiz4DSys.GetSYS_ScreenQuery());
if I change _eBiz4DSys.SYS_Screens into _eBiz4DSys.SYS_Screens.ToList() xamgrid can delete or add row but didn't effect to Entity even I call submitchange as your suggested.
Thanks