Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
弄清楚这一点有些麻烦。所以我有一个简单的组合框,我将它绑定到代码隐藏中的现有 DataTable,如下所示:
roomCombo.ItemsSource = ((IListSource) myDataTable).GetList(); roomCombo.DisplayMemberPath = "Number";
组合框显示了我在数字列中的所有内容,当然包括重复项。我正在寻找一种仅显示独特价值的方法..
谢谢。
我找到了一个很好的方法来做到这一点:
DataView view = new DataView(myDataTAble); DataTable distinctValues = view.ToTable(true, columnName);