WPF DataGrid horizontal scrollbar not showing

后端 未结 7 1920
眼角桃花
眼角桃花 2021-02-05 08:14

I have created simple DataGrid with 4 columns, which go outside the bounds of DataGrid, and horizontal scrollbar is not showing. I tried setting width to each column but nothing

相关标签:
7条回答
  • 2021-02-05 08:49

    The scrolling will work automatically as soon as you add some data to the grid. To test you can apply this code

    Name your grid to "grid"

    Attached the Window Loaded event

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            grid.Items.Add(new object());
        }
    

    You will see the scrolling appears.

    0 讨论(0)
提交回复
热议问题