简体   繁体   English

WPF DataGrid具有组合框,文本和复选框列并保存到CSV

[英]Wpf datagrid with combobox,text and checkbox columns and saving into csv

I had created a wpf datagrid with three columns. 我用三列创建了一个wpf datagrid。

Text column
Combobox Column
Checkbox column

The Combobox items are loaded in C# Code behind. Combobox框项目在后面的C#代码中加载。 I have done binding the combobox items using observable collection but the items are not getting displayed in DG after selection. 我已经使用可观察的集合完成了combobox项目的binding ,但是选择后这些项目没有显示在DG

One more thing i need to save this datagrid as a CSV . 我还需要将datagrid另存为CSV

Make sure you are implementing INotifyPropertyChanged on the property you have bound to the Combobox itemsource if you are setting (replacing) the entire ObservableCollection in your code behind. 如果要在后面的代码中设置(替换)整个ObservableCollection,请确保在绑定到Combobox itemsource的属性上实现INotifyPropertyChanged

Failing that also check your Output window for any binding errors eg typo's etc. 失败的话还要检查“输出”窗口中是否存在任何绑定错误,例如错字等。

This article describes saving datagrid data to csv 本文介绍将datagrid数据保存到csv

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

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