我的带有 WPF C# 的 DataGrid 未填充第 1 列,而是填充其他列

问题描述 投票:0回答:1

WPF C#,尝试填充数据网格,但由于某种原因跳过第 1 列... 我还在习惯 WPF,所以我怀疑这是某种默认值或属性中的设置。

DataTable dt = new DataTable();
dt.Columns.Add("Subtest/Subdomain");
dt.Columns.Add("Standard & Scaled Scores");
dt.Columns.Add("Percentile");
dt.Columns.Add("Description");

dt.Rows.Add("1","2","3","4");

dataGridBayley4.ItemsSource = dt.DefaultView;
<DataGrid x:Name="dataGridBayley4" HorizontalAlignment="Left" Height="315" Margin="76,131,0,0" VerticalAlignment="Top" Width="638" SelectedIndex="0" Grid.RowSpan="1" Grid.ColumnSpan="1" Grid.Row="1" Grid.Column="1" />

我已经研究了几个小时,但没有运气...我尝试过属性,甚至在我为 dt[0][0] 执行 messagebox.show 时看到了值

c# wpf datagrid
1个回答
0
投票

我的列名称中有特殊字符,导致了干扰。

© www.soinside.com 2019 - 2024. All rights reserved.