Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, this is what I came to after some experimenting.</p> <p>I have created an Expression Blend 3 trigger with a dependency property (I named it Subscription). I bind the Subscription to the same value that my TextBlock is bound to and this trigger is attached to a ControlStoryboardAction from Expression Blend 3.</p> <p>Here's the trigger:</p> <pre><code>public class DataTriggerPlus : TriggerBase&lt;DependencyObject&gt; { public static readonly DependencyProperty SubscriptionProperty = DependencyProperty.Register("Subscription", typeof(string), typeof(DataTriggerPlus), new FrameworkPropertyMetadata("", new PropertyChangedCallback(OnSubscriptionChanged))); public string Subscription { get { return (string)GetValue(SubscriptionProperty); } set { SetValue(SubscriptionProperty, value); } } private static void OnSubscriptionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ((DataTriggerPlus)d).InvokeActions(null); } } </code></pre> <p>Here's how it is attached to the storyboard:</p> <pre><code>&lt;TextBlock x:Name="textBlock" Text="{Binding TestProp}" Background="White"&gt; &lt;i:Interaction.Triggers&gt; &lt;local:DataTriggerPlus Subscription="{Binding TestProp}"&gt; &lt;im:ControlStoryboardAction Storyboard="{StaticResource Storyboard1}"/&gt; &lt;/local:DataTriggerPlus&gt; &lt;/i:Interaction.Triggers&gt; &lt;/TextBlock&gt; </code></pre> <p>I like this approach a lot, great job Blend 3 designers!</p> <p>Edit: answering Drew comment...</p> <p>Yes, it ships with Blend. You can just include Microsoft.Expression.Interactions.dll and System.Windows.Interactivity into your project.</p> <p>And yes, it is verbose (I have asked if somebody figured out a good way to apply behaviours via Styles <a href="https://stackoverflow.com/questions/1252277/is-it-possible-to-apply-blend-behavior-using-style-or-template">in this question</a>) - but there is also a benefit of flexibility. For example you can not only start a storyboard, but also switch a state or do some other action from the same trigger.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload