如何为datagrid列赋值? [英] How to assign values to datagrid column ?
本文介绍了如何为datagrid列赋值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在c#中,我们可以将值分配给特定列,如下面的代码
In c# we can assign values to particular column like the code below
dataGridName.Rows[row].Cells["colName"].Value="value"
但是如何在WPF中实现相同的机制?
but how to implement same mechanism in WPF?
推荐答案
检查这个out:如何获取和设置-w -f-data-of-cell-in-provide-provide-columnidnex [ ^ ]
Check this out: how-to-get-and-set-the-value-of-a-cell-in-wpf-datagrid-by-providing-columnidnex[^]
在WPF中,将记录绑定到数据网格的理想方法是使用Binding。
以下是一些示例 -
WPF动态生成的DataGrid [ ^ ]
DataGrid教程 [ ^ ]
In WPF, the ideal way to bind records to a datagrid is by using Binding.
Here are some examples -
WPF Dynamically Generated DataGrid[^]
DataGrid Tutorial[^]
这篇关于如何为datagrid列赋值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文