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
40
xamGrid not adding
posted

 

I am trying to add rows to a xamgrid, this code will add the rows.  However, when I try to Submit the changes 
to the datacontext, the data context does not recognize that I have added rows, so it will not submit the changes to the database.

It will locally add rows, just not save them.  Any thoughts?

//datagrid.cs
  public NotesView()
        {
            InitializeComponent();
                
            this.Loaded += new RoutedEventHandler(UserControl_Loaded); 

        }
        void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.myXamGrid.ItemsSource= new ObservableCollection<EntityObject>(EntityObjectCollection);

        }
//datagrid.xaml

                    <igGrid:XamGrid x:Name="myXamGrid" AutoGenerateColumns="False" ColumnWidth="*"
                                        VerticalAlignment="Top" RowHover="Row" 
                        >
                        <igGrid:XamGrid.CellStyle>
                            <Style TargetType="igGrid:CellControl">
                                <Setter Property="FontSize" Value="10"></Setter>
                            </Style>
                        </igGrid:XamGrid.CellStyle>
                        <igGrid:XamGrid.SelectionSettings >
                            <igGrid:SelectionSettings CellClickAction="SelectRow"  RowSelection="Single"/>
                        </igGrid:XamGrid.SelectionSettings>
                        <igGrid:XamGrid.EditingSettings>
                            <igGrid:EditingSettings AllowEditing="Row" IsEnterKeyEditingEnabled="True" IsF2EditingEnabled="True" IsMouseActionEditingEnabled="DoubleClick" IsOnCellActiveEditingEnabled="True"/>
                        </igGrid:XamGrid.EditingSettings>
                        <igGrid:XamGrid.AddNewRowSettings>
                            <igGrid:AddNewRowSettings AllowAddNewRow="Top" IsEnterKeyEditingEnabled="True" IsF2EditingEnabled="True" IsMouseActionEditingEnabled="SingleClick" IsOnCellActiveEditingEnabled="True"/>
                        </igGrid:XamGrid.AddNewRowSettings>
                        <igGrid:XamGrid.RowSelectorSettings>
                            <igGrid:RowSelectorSettings Visibility="Visible" EnableRowNumbering="False"/>
                        </igGrid:XamGrid.RowSelectorSettings>
                        <igGrid:XamGrid.ColumnMovingSettings>
                            <igGrid:ColumnMovingSettings AllowColumnMoving="Disabled"/>
                        </igGrid:XamGrid.ColumnMovingSettings>
                        <igGrid:XamGrid.Columns>
                            <igGrid:DateColumn Key="DateEntered" HeaderText="Date Entered"/>
                            <igGrid:TextColumn Key="Entry" TextWrapping="Wrap" Width="*"/>
                        </igGrid:XamGrid.Columns>

                    </igGrid:XamGrid>

 

Parents
No Data
Reply
  • 5595
    posted

    Hi,

    Could you provide the code which performs submitting the rows?

    I am guessing that you are using RIA services, but in this case, why are you data binding the Grid to separate collection:

    this.myXamGrid.ItemsSource= new ObservableCollection<EntityObject>(EntityObjectCollection);

     

    Thanks,

Children