I am very pleased with my small collection of Blend behavior, actions and triggers - they are easy to use and powerful. But I still cannot figure out how to avoid applying them based on each element. For example, if I have a behavior as such:
<Rectangle> <i:Interaction.Behaviors> <il:MouseDragElementBehavior/> </i:Interaction.Behaviors> </Rectangle>
and I have several draggable rectangles in my window, each of which should have an overloaded label. I would like to write something like this:
<Style x:Key="RectangleStyle" TargetType="{x:Type Rectangle}"> <Setter Property="i:Interaction.Behaviors" Value="il:MouseDragElementBehavior"/> </Style>
It could be a style, template, or some other way to avoid repeating the markup of a behavior or action. The best solution I've come up with so far is to create a special behavior for the container (when attached, it lists the children associated with the child events). Any ideas?
wpf xaml expression-blend
Sergey Aldoukhov
source share