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
140
using xamGrid edit cells to enter data
posted

Hi, I have set up my xamGrid but cannot seem to even enter edit mode at this point.  I want to start off with an empty xamGrid, and have the user fill in the data, then save it to a database.  Here is xaml,

<ig:XamGrid HorizontalAlignment="Left" AutoGenerateColumns="False" Margin="45,334,0,0" Name="xamGrid1" VerticalAlignment="Top" Height="241" Width="302">
<ig:XamGrid.Columns>
<ig:UnboundColumn HeaderText="Book Code" Key="sBookCode" Width="100"></ig:UnboundColumn>
<ig:UnboundColumn HeaderText="Page Type" Key="sPageType" Width="100"></ig:UnboundColumn>
<ig:TextColumn HeaderText="Page Number" Key="sPageNumber" Width="100"></ig:TextColumn>
</ig:XamGrid.Columns>
<ig:XamGrid.AddNewRowSettings>
<ig:AddNewRowSettings AllowAddNewRow="Top" IsEnterKeyEditingEnabled="True" IsF2EditingEnabled="True"
IsMouseActionEditingEnabled="SingleClick" IsOnCellActiveEditingEnabled="True"></ig:AddNewRowSettings>
</ig:XamGrid.AddNewRowSettings>
<ig:XamGrid.EditingSettings>
<ig:EditingSettings AllowEditing="Cell" IsEnterKeyEditingEnabled="True" IsF2EditingEnabled="True" IsMouseActionEditingEnabled="SingleClick" IsOnCellActiveEditingEnabled="True" />
</ig:XamGrid.EditingSettings>
</ig:XamGrid>

When I single click on the row, nothing happens, cannot type anything.  Does the grid have to have a databinding or an itemsource to operate off of? F2 editing does not work, adding this code does nothing as well.


private void xamGrid1_CellClicked(object sender, Infragistics.Controls.Grids.CellClickedEventArgs e)
{
xamGrid1.EnterEditMode((Row)xamGrid1.ActiveCell.Row, xamGrid1.ActiveCell);
}

So I'm curious, what is required for the xamGrid to actually enter edit mode?  Also, I found a similar project with the following code and it worked great, just like I want it to work in mine.

private void gridKeywords_RowAdding(object sender, Infragistics.Controls.Grids.CancellableRowAddingEventArgs e)
{
PODRIAServicesLibrary.Web.Model.JobTag newRow = (PODRIAServicesLibrary.Web.Model.JobTag) e.Row.Data;
newRow.JobID =((PrintOnDemand.ViewModel.EditJobViewModel) gridKeywords.DataContext).CurrentJob.JobID;
((ViewModel.EditJobViewModel)gridKeywords.DataContext).CurrentJob.JobTags.Add(newRow);
e.Cancel = true;
}

The only difference I can see is the ViewModel have bindings set to the grid and creates a binding to the ID before editing, so that when the data is entered, it is already associated with an ID