Inserting rows using AddNewRowPosition no longer works

Hello,

Recently inserting rows using AddNewRowPosition no longer works. This is the code snipped that i tried to showcase the issue:

public class DataModel : NotifyPropertyChanged

{

public DataModel(double x, double y)

{

_xValue = x;

_yValue = y;

}


private double _xValue;


public double XValue

{

get => _xValue;

set => Set(ref _xValue, value);

}


private double _yValue;


public double YValue

{

get => _yValue;

set => Set(ref _yValue, value);

}

}


in my viewmodel I have:

private ObservableCollection< DataModel > _dummyData = new();

public ObservableCollection< DataModel > DummyData

{

get => _dummyData;

set => Set(ref _dummyData, value);

}


In xaml:

Grid.Row="0"

Grid.RowSpan="2"

Grid.Column="1"

AddNewRowPosition="Bottom"

AllowDeleting="True"

AllowDraggingColumns="True"

AllowDraggingRows="True"

AllowDrop="True"

AllowEditing="True"

AllowFiltering="True"

AllowResizingColumns="True"

AutoGenerateColumns="False"

EnableDataVirtualization="True"

GridCopyOption="CopyData,CutData"

GridPasteOption="PasteData"

ItemsSource="{Binding DummyData, Mode=TwoWay}"

LiveDataUpdateMode="AllowDataShaping"

SelectionMode="Extended"

SelectionUnit="Row"

ShowRowHeader="True"

UsePLINQ="True">


MappingName="XValue"

MaxValue="360"

MinValue="0"

NumberDecimalDigits="2" />



I can click and edit the insert row:




But after I press enter:


The values are not added

Note that if I modify the collection from the viewmodel, the binding works. 


Thank you for your help!


3 Replies 1 reply marked as answer

SS Sampathnarayanan Sankaralingam Syncfusion Team January 6, 2022 03:25 PM UTC

Hi Emanuel, 

We have checked your reported issue. We have found you didn’t added the default constructor in the  underlying data object and addnewrow works only when adding the default constructor in the underlying data object. We have created the sample with your provided code snippet. Please refer the sample from below link and also refer the UG link. 



Regards, 
Sampath Narayanan.S 


Marked as answer

EM Emanuel January 6, 2022 04:51 PM UTC

Hello,

Thank you, that was it.


Best regards,

Emanuel Hristea



SS Sampathnarayanan Sankaralingam Syncfusion Team January 7, 2022 02:29 PM UTC

Hi Emanuel,


We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊.


Regards,

Sampath Narayanan.S


Loader.
Up arrow icon