Does WPF DataGrid fire an event when a row is added / removed?

前端 未结 7 611
失恋的感觉
失恋的感觉 2021-02-06 05:48

I wish to recalculate things everytime a DataGrid gets more rows or some are removed. I tried to use the Loaded event, but that was fired only once.

I found

7条回答
  •  后悔当初
    2021-02-06 06:41

    Depending on what "things" you want to recalculate, you might consider using the ScrollViewer.ScrollChanged attached event. This can be set in XAML as follows:

    
    

    The ScrollChangedEventArgs object has various properties that can be helpful for computing layout and scroll position (Extent, Offset, Viewport). Note that these are typically measured in numbers of rows/columns when using the default virtualization settings.

提交回复
热议问题