Please tell me how to make it so that when adding items to a DataGrid, if the number of items exceeds the size of the table automatically scrolls to the lowest last added item?

  • Somebody here in the comments at the very beginning wrote some interesting variant with inheritance from some kind of collection and immediately deleted it, I did not have time to check it. Bring back please, maybe this is what you need ... - PECHAILTER
  • Here you are: codeproject.com/Questions/227459/… - Denis Bubnov

1 answer 1

For example, try using the ScrollIntoView method .

dataGrid.ScrollIntoView(dataGrid.Items[dataGrid.Items.Count - 1]); 
  • and in what event handler to write this? - PECHAPTER
  • @DarkByte likely to add a new item - Yurii Manziuk
  • @Yurii Manziuk as I already wrote above - the elements are added dynamically through the binding. - PECHAPTER
  • @DarkByte but is someone causing the dataGrid.Bind () event? - Aleksandr Zharinov
  • @Aleksandr Zharinov how do I know who is calling him? ObservableCollection probably calls it to which I have a table attached to xaml. - PECHAPTER