📜  wpf scoll to on new item datagrtid - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:44.684000             🧑  作者: Mango

代码示例1
if (mainDataGrid.Items.Count > 0)
{
    var border = VisualTreeHelper.GetChild(mainDataGrid, 0) as Decorator;
    if (border != null)
    {
        var scroll = border.Child as ScrollViewer;
        if (scroll != null) scroll.ScrollToEnd();
    }
}