将文本框绑定到数据表的特定行/列 [英] Bind Textbox to specific row/column of a datatable

查看:211
本文介绍了将文本框绑定到数据表的特定行/列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个强类型的数据集,其中包含一个具有静态行数的DataTable。我试图将单个标签和文本框绑定到datatable中的某些行/列组合。当我直接绑定到dataTable文本框不更新。我已经尝试通过CollectionViewSource绑定,但不仅不更新,它也不允许我选择我要绑定到的数据行。将文本框绑定到DataTable的特定行和列的最佳方式是什么?具体来说,我正在寻找在XAML中作为源和路径指定的内容。

解决方案

 < TextBox Text ={Binding YourTable.Rows [1] [ColumnName]}/> 


I have a strongly type Dataset containing a DataTable with a static number of rows. I am trying to bind individual labels and textboxes to certain row/column combinations in the datatable. When I bind directly to the dataTable the textbox does not update. I have tried binding through a CollectionViewSource, but that not only doesn't update, it also doesn't allow me to select the row of the data to which I am trying to bind. What is the best way to bind a textbox to a specific row and column of a DataTable? Specifically I am looking for what I should specify in the XAML as the Source and Path.

解决方案

<TextBox Text="{Binding YourTable.Rows[1][ColumnName]}"/>

这篇关于将文本框绑定到数据表的特定行/列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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