[UWP]如何使用DataGrid控件自定义Form或Flyover。 [英] [UWP]How to use a custom Form or Flyover with DataGrid control.

查看:192
本文介绍了[UWP]如何使用DataGrid控件自定义Form或Flyover。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows Community Toolkit for UWP中查看DataGrid控件(文档),我希望能够编辑行数据或添加新的
行而不是内联,但是在单独的表单或天桥中。我提供的链接有一个显示它的例子,但我希望能够有一个双向绑定,所以我可以修改数据。你能提供一个例子吗?

解决方案

如果你不想那样内联,最好创建一个新的DataGrid。要编辑行数据,e 提取目标行的数据,将其显示在另一个数据网格中。编辑完成后,将新数据保存回数据库。所以你只需要
来为数据源和原始DataGrid创建双向绑定。 看看这个:
https://docs.microsoft.com/en-us/windows/uwp/data-binding/data-binding-in-depth

I am looking at DataGrid control in Windows Community Toolkit for UWP (documentation), and I would like to be able to edit row data or add new row not inline, but in a separate form or a flyover. The link I provided, has an example of displaying it, but I would like to be able to have a two-way binding so I can modify data. Can you please provide an example?

解决方案

If you don't want to do that inline, better to create a new DataGrid. To edit row data, extract the data of the target row, show it in another datagrid. After it has been edited, save the new data back into the datasouce. So you just need to create two-way binding for the datasource and the original DataGrid.  Have a look about this:https://docs.microsoft.com/en-us/windows/uwp/data-binding/data-binding-in-depth


这篇关于[UWP]如何使用DataGrid控件自定义Form或Flyover。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆