问题描述
我是WPF的新手。我知道如何在Windows窗体中很好地使用DataGridView控件。但我发现DataGrid是WPF的替代品。我想要一个很好的例子来在WPF中的DataGrid中添加和编辑数据。
例如我在数据库中有下表:
I am new to WPF. I know how to use the DataGridView control well in Windows Forms. But I see that the DataGrid is the alternative in WPF. I want a good example for adding and editing data in a DataGrid in WPF.
For example I have the following table in database:
Channel Point Value
_________________________
A 1 w
B 1 x
A 2 y
B 2 z
上表必须以这种格式显示:
The above table has to be displayed in this format:
Point A SomeColumnM B SomeColumnN
_____________________________________________
1 w w/100 x x*1000
2 y y/100 z Z*1000
通道数量不固定,即通道C和D也可以存在。
我还有一些计算列,我必须根据列A,B,C或D插入。
如果存在通道C,则应插入在A和SomeColumnM行之后应评估为(A + C)/ 100。类似地,如果数据库中存在通道D,则应在B之后插入,并且应将SomeColumnN计算为(B + D)* 1000。
在运行时添加列的一个很好的例子可能会有所帮助。
The number of channels are not fixed, i.e, Channels C and D can also be present.
I also have some calculated columns which I have to insert based on the columns A, B, C or D.
If channel C is present, then it should be inserted after A and SomeColumnM rows should be evaluated as (A+C)/100. Similarly if Channel D is present in database, it should be inserted after B and SomeColumnN should be computed as (B+D)*1000.
A good example for adding columns at run time may be helpful.
推荐答案
这篇关于将数据添加到DataGrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!