Interactivity.Behavior vs attached properties

后端 未结 4 648
萌比男神i
萌比男神i 2021-01-30 17:41

I\'m trying to find some differences between these approaches. Is there any situation where behaviors are used and the same functionality could not be done with attached propert

4条回答
  •  日久生厌
    2021-01-30 18:30

    I tend to use Behaviors to add functionality which makes visible changes. Whereas I use attached properties to add additional information to an object which is subsequently used by other objects.

    E.g. Grid.Row makes a good attached property, as it's used by the Grid and not the target. On the other hand, AutoCorrect would make a good behaviour, as this will make visible changes on the object.

提交回复
热议问题