如何在 WPF 的数据网格中添加删除列,当我添加此列时,在使用 ItemsSource 错误之前,得到的 Items 集合必须为空
<DataGrid AutoGenerateColumns="True" ItemsSource="{Binding}" Name="dgStatus"
HorizontalAlignment="Left" Margin="10,23,0,0" VerticalAlignment="Top"
RenderTransformOrigin="-23.633,-5.198" Height="364" Width="811"
CellEditEnding="myGrid_CellEditEnding" >
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="Delete" x:Name="btnDelete" Click="btnDelete_Click"></Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid>