简体   繁体   English

Winform DataGridView到UWP Datagrid C#

[英]Winform DataGridView to UWP Datagrid C#

I was looking to transition from Winforms to UWP. 我当时想从Winforms过渡到UWP。 In my first prjoct I need to build a table of data which is dynamic in nature. 在我的第一个过程中,我需要构建一个本质上是动态的数据表。 I have accomplished this with a DataGridView in WinForms very easily by adding columns dynamically and formating the cells according to the cell value. 通过动态添加列并根据单元格值格式化单元格,我很容易在WinForms中使用DataGridView完成了此操作。

  AREA1 | CAR10 | CAR 7 | CAR3 |  |
+=======+=======+=======+======+==+
| AREA2 |       |       |      |  |
+-------+-------+-------+------+--+
| AREA3 | CAR5  | CAR1  |      |  |
+-------+-------+-------+------+--+
| AREA4 |       |       |      |  |
+-------+-------+-------+------+--+
| AREA5 | CAR4  |       |      |  |
+-------+-------+-------+------+--+
| AREA6 |       |       |      |  |
+-------+-------+-------+------+--+
| AREA7 | CAR21 | CAR45 |      |  |
+-------+-------+-------+------+--+
| AREA8 |       |       |      |  |
+-------+-------+-------+------+--+
|       |       |       |etc..      |  |
+-------+-------+-------+--

It's very inportant to be able to format the cells accoring to the underly objects properties. 能够根据底层对象属性格式化单元格非常重要。 I have been looking at a couple of datagrid controls mainly the Telerik UI for UWP Datagrid but I can not see how you dynamically create the properties and then format the cells. 我一直在查看几个datagrid控件,主要是UWP Datagrid的Telerik UI,但是我看不到如何动态创建属性然后格式化单元格。 I think it would be easy if it was possible to format the grid in the Code behind of the Xaml but this seems the incorrect way? 我认为,如果可以在Xaml后面的代码中格式化网格,那将很容易,但这似乎是不正确的方法?

UWP Community Toolkit的 DataGrid控件是企业和LOB应用程序的标准和推荐方法,特别是在需要诸如数据结构之类的表时,它具有从单元格编辑到虚拟化再到通过UI或后端编辑每个单元格所需的一切。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM