Binding: WPF vs WinForms

As far as I know, INotifyPropertyChanges was "invented" before WPF. Can someone explain what's new in WPF, which allowed us to perform various types of binding properties of a control to properties of objects.

Or was it also available in WinForms, but was not so popular for some reason? (if so, what are the reasons)?

Thanks.

+4
source share
1 answer

In WPF, you can bind not only to objects that implement INotifyPropertyChanged , but also to dependency objects that display dependency properties that are much more flexible than regular properties.

There are also new collection interfaces:

  • INotifyCollectionChanged , which allows collections to send notifications when items are added, deleted, or replaced.
  • ICollectionView , which defines how the collection is presented in the user interface

The WPF binding mechanism is also much more flexible than Windows Forms bindings ... In Windows Forms, you can only say: Bind property X of object A to property Y of object B. There was no DataContext, so you couldn't define relative bindings. You cannot use complex property paths (for example, AXItems [foo] .Bar). All conversions should be performed in event handlers, not reusable converters. Bindings can only be defined on controls, whereas in WPF, any DependencyObject can use bindings. And so on...

+5
source

Source: https://habr.com/ru/post/1299011/


All Articles