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
325
XamDataGrid's ScrollToLastRowByIndex doesn't work
posted

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?