int nIndex = 0; private async void BtnMeasureClick(object sender, EventArgs e) { PhotometricMeasureData test = new PhotometricMeasureData(); ++nIndex; test.No = nIndex.ToString(); test.Cell = string.Format("C[{0}]", nIndex); test.DateTime = DateTime.Now;
for (int i = 0; i < this.m_Model.WaveLength.Count; i++) { test.ABS.Add(new Random().Next(-10, 10)); test.Trans.Add(new Random().Next(-10, 10)); }
this.m_Model.MeasureData.Add(test);
int n = this.m_Model.MeasureData.Count; this.xDataGrid.ScrollToLastRowByIndex(n); }
public ObservableCollection<PhotometricMeasureData> MeasureData { set; get; } = new ObservableCollection<PhotometricMeasureData>();
public class PhotometricMeasureData { public string No { get; set; } public string Cell { get; set; } public DateTime DateTime { get; set; } public List<float> ABS { get; set; } = new List<float>();
public List<float> Trans { get; set; } = new List<float>(); }
Click the button to create and insert virtual data. But it doesn't move to the last line.
Is there any other reason? One strange thing is that you shouldn't put count in the index, but if you set it to int n = 10 it will work.
is this a bug?
Hello,
I have modified the sample project that I sent you with the relevant code that you have provided and on my end, the grid still scrolls if I pass the Count of my data source minus 1.
For consistency, I am attaching the modified version of the sample project so you can try it on your end. Please run it on your end, as it may help to further narrow down what the issue is here.
If the sample works, this means there is still something specific about the code in your application that is preventing the scroll.
If the sample does not work, this means there is a difference in the environment that we are testing in or perhaps the assemblies that we are targeting. My tests were made against version 20.1.35 of the Infragistics for Xamarin toolset. I tested on a Google Pixel 3 device against Android version 12.
Please let me know if you have any other questions or concerns on this matter.
8741.XFGridScrollTest.zip