直接使用DataGrid.ItemsSource = adp绑定的是一个名为Length的列,显示的是每个项的长度;

需要使用  .Select(x => new { Value = x }).ToList()  才能展示值;

private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            new Thread(() => {
                List<string> adp = MySqlHelper.selectSQL("select name from perinfo;");
                this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate {
                    DataGrid.ItemsSource = adp.Select(x => new { Value = x }).ToList();
                });
            }).Start();
        }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2022-03-01
  • 2022-02-23
  • 2022-02-27
相关资源
相似解决方案