|
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += DispatcherTimer_Tick;
dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
dispatcherTimer.Start();
private void DispatcherTimer_Tick(object sender, object e)
{
var collection = (this.dataGrid.DataContext as ViewModel.ViewModel).OrdersInfo;
collection.Insert(0, new OrderInfo() { OrderID = 100, EmployeeID = 100111, ShipCity = "China", ShipCountry = "Japan" });
var index = collection.IndexOf(collection.FirstOrDefault(x=>x.OrderID == 10000));
var resolveIndex = this.dataGrid.ResolveToRowIndex(index);
this.dataGrid.ScrollInView(new Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex(resolveIndex, 0));
}
private async void Stoper()
{
dispatcherTimer.Stop();
} |
|
var collection = (this.dataGrid.DataContext as ViewModel.ViewModel).OrdersInfo;
collection.Insert(0, new OrderInfo() { OrderID = 100, EmployeeID = 100111, ShipCity ="China", ShipCountry = "Japan" });
var index = collection.IndexOf(collection.FirstOrDefault(x => x.OrderID == 10499));
var resolveIndex = this.dataGrid.ResolveToRowIndex(index);
this.dataGrid.GetVisualContainer().ScrollOwner.ChangeView(0, (this.dataGrid.GetVisualContainer().ScrollRows as PixelScrollAxis).TotalExtent, 1, true);
|