我有一个要显示给用户的数据集,但我只希望他们能够编辑最新的(第一行)数据。我需要向他们显示其他行数据以供引用。我不必将所有内容都保存在同一个 DataGrid 中,但如果可能的话,我希望这样做。
我是 WPF 的新手,因此非常感谢任何帮助/想法!
最佳答案
明白了,我只是取消对第一行以外的任何行的编辑。
private void dataGridStats_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
{
if (e.Row.GetIndex() != 0)
{
e.Cancel = true;
}
}
关于wpf - 我可以只编辑一行 WPF DataGrid 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1496274/