I’m trying to implement a behavior that works on an object, but is affected by a second object.
As an example, it will change the appearance of the framework element based on the distance of another framework element.
I know just enough about attached behaviors to be dangerous, and I would define my class like this :
public class ChangeWithDistance : Behavior<FrameworkElement>
And somewhere in the behavior I would need a dependency property that would point at the name(?) of the other control.
What is the class I should make my dependency property so that I can have this behavior point to another control?
Would I specify the propdp as a string that represents the name of the other control?
Or is there another class I should use that signifies the tag associated with a control (you know, that x:Name business..)
Or should the propdp be pointing at a framework element like this?
public static readonly DependencyProperty OtherControl =
DependencyProperty.Register("OtherControl", typeof(FrameworkElement)
Or do I do something with binding?
Is there a best practice of how to point a behavior or really anything that has a dependency property at another control?
Is there a way to make it show up so a user using blend can select the other control?
I’m having good luck declaring my dependency property as such :
And then in the XAML binding it to the other object I am interested like this :