开发者

Why Use IEditableCollectionView?

I've got a project I've got to crank out (thanks to an employee quitting on the job before the deadline).

He'd been working in WPF. The interface looked cool, but it never was able to collect data from the company's old data access DLLs. (Rewriting the DLLs is a great idea, but not feasible in the short time left by the deadline) 开发者_如何学运维Collecting data was the whole point!

The project was thrown at me, but I'm no WPF developer. I've been told to make it work with WinForms, which is what I know. I had a WinForm interface cranked out in a few hours, and it looks every bit as good as the WPF version ...and I know what it is doing. WPF involves voo-doo I haven't learned yet.

There are things used in the WPF project that I need to get a grasp of what they do, and I do not have time to completely redesign it all.

The Business Logic Layer returns an ObservableCollection to the WPF interface.

The WPF interface takes the ObservableCollection and stores it in a CollectionViewSource using its Source parameter.

OK, I'm immediately thinking DataGridView control and using the DataSource parameter from it.

Am I on track?

What was the point of the IEditableCollectionView? Is it necessary? And if not, should I just remove all references to it?


ObservableCollection, CollectionViewSource etc. are important in the WPF's MVVM (MVC...+) scheme. You could drop them but you could certainly reuse them in a WinForms project. It might actually be better to do so to retain the clean separation between UI and data.

You could also hang on to them and use them as "more standard" collections which would simply result in a little bit of unnecessary overhead. And since meeting your deadline is of utmost importance, this might be the way to go.


The observable collection is used so that other controls can participate when the collection is added to, removed, or refreshed. This helps keep the entire UI in sync. As far as the IEditableCollectionView, it raises the INotifyPropertyChanged event so that the controls on the WPF form automatically update when a property in the collection is updated.

If you are doing this in WinForms, you just need to raise events when your collection has changed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜