tags:

views:

295

answers:

2

Hi,

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 properties?

+3  A: 

No. Behaviors are basically just a much nicer abstraction on top of attached properties.

By using Behavior<T>, you gain access to the AssociatedObject directly, as well as the ability to attach and detach the behavior, easily, at runtime.

You could do this with attached properties, but it would require adding a lot of extra plumbing.

Reed Copsey
A: 

Behviors are based on attached properties. That means if you can't find specific behavior - you write your own, either based on behavoirs framework provided by Blend or by creating your own AP...

I always though that behaviors are great evidence of attached properties power. Just incredible what you can get with them.

Anvaka