locked
How to conditionally trigger storyboard using Blend? (Meik Schuetz) - 1/8/2008 7:22 AM PST RRS feed

  • Question

  • By: Meik Schuetz


    Dear all,
    I’d like to know if and how it is possible to conditionally trigger a 
    storyboard in dependency of a user controls property. 
    
    Example:
    - Trigger storyboard fadeIn, if button button1 clicked and user control uc1 
    is hidden.
    - Trigger storyboard fadeOut, if button button1 clicked and user control uc1 
    is visible.
    
    Until now I did this kind of things using C# code, but I’d like to know if 
    Blend supports such kind of scenarios (preferencially without coding XAML 
    manually).
    Thanks for any information that might be useful.
    
    Best regards
    Meik Schuetz
    
    Friday, February 22, 2008 3:58 PM

All replies

  • Brennon Williams


    Howdy,

    There is a concept of multitriggers but I dont think they will fit your
    specific purpose in your example.. you can read more from here though:

    http://msdn2.microsoft.com/en-us/library/system.windows.multitrigger.aspx

    Sometimes it is just easier to do things in code, or if you really want to
    enforce that things are triggered withing the XAML then a series of
    dependency properties on your controller object (such as main window) will
    allow you to be more judicious in your trigger declarations.

    HTH

    Cheers

    --
    Want to learn how to use Blend and visual studio?

    http://www.learnexpressionstudio.com
    http://www.expressionblend.com
    http://www.x-coders.com


    "Meik Schuetz" wrote:

    > Dear all,
    > I’d like to know if and how it is possible to conditionally trigger a
    > storyboard in dependency of a user controls property.
    >
    > Example:
    > - Trigger storyboard fadeIn, if button button1 clicked and user control uc1
    > is hidden.
    > - Trigger storyboard fadeOut, if button button1 clicked and user control uc1
    > is visible.
    >
    > Until now I did this kind of things using C# code, but I’d like to know if
    > Blend supports such kind of scenarios (preferencially without coding XAML
    > manually).
    > Thanks for any information that might be useful.
    >
    > Best regards
    > Meik Schuetz
    >
    Saturday, February 23, 2008 12:16 AM
  • Meik Schuetz


    Hi Brennon,
    first of all, thanks for your response. I've got a designer sitting next to
    me, who'd like to define such conditional storyboards to explain better user
    interaction to the final decision makers - would be a "nice to have" for us
    if this could be done directly in Blend.

    Anyways, how is your book doing? I guess, besides me, there are a bunch of
    people anxiously waiting for something to have in hands :)

    Thanks again
    Best Regards
    Meik Schuetz

    "Brennon Williams" wrote:

    > Howdy,
    >
    > There is a concept of multitriggers but I dont think they will fit your
    > specific purpose in your example.. you can read more from here though:
    >
    >
    http://msdn2.microsoft.com/en-us/library/system.windows.multitrigger.aspx
    >
    > Sometimes it is just easier to do things in code, or if you really want to
    > enforce that things are triggered withing the XAML then a series of
    > dependency properties on your controller object (such as main window) will
    > allow you to be more judicious in your trigger declarations.
    >
    > HTH
    >
    > Cheers
    >
    > --
    > Want to learn how to use Blend and visual studio?
    >
    >
    http://www.learnexpressionstudio.com
    > http://www.expressionblend.com
    > http://www.x-coders.com
    >
    >
    > "Meik Schuetz" wrote:
    >
    > > Dear all,
    > > I’d like to know if and how it is possible to conditionally trigger a
    > > storyboard in dependency of a user controls property.
    > >
    > > Example:
    > > - Trigger storyboard fadeIn, if button button1 clicked and user control uc1
    > > is hidden.
    > > - Trigger storyboard fadeOut, if button button1 clicked and user control uc1
    > > is visible.
    > >
    > > Until now I did this kind of things using C# code, but I’d like to know if
    > > Blend supports such kind of scenarios (preferencially without coding XAML
    > > manually).
    > > Thanks for any information that might be useful.
    > >
    > > Best regards
    > > Meik Schuetz
    > >
    Saturday, February 23, 2008 12:16 AM
  • Brennon Williams


    Howdy Meik,

    You can certainly build multi-triggers with Blend when you are creating
    property triggers inside a template.

    Edit the template of something (even a button), and then add or select a
    PROPERTY trigger.

    You will see the section that says "Activated when", which also has a little
    "+" button to the right of it, which is where you can keep adding conditions
    for a trigger to evaluate to true, which when does then as per normal fires
    and carries out your declared "Actions when activating" tasks.

    As you have seen there are areas where you need more flexibility in the
    availability of conditional triggering, which I am not sure where this
    heading at present in Blend so perhaps someone from the dev team can offer
    some guidence there.


    The book is coming along and it certainly helps that the UI is now completed
    for Blend2, which made it impossible to take screenshots until this was done.
    It has been one of those nightmare projects that has taken forever, so yes I
    too will be glad when it is in peoples hands:-)

    I will probably add a blog for it shortly which will help keep people
    informed of its progress... its all just time which keeps beating me up!

    With respect to going to your desicion makers about Blend; please let them
    know as I am sure you will that Blend is very rapidly evolving so any
    percieved short-comings at present are bound to be addressed in future
    builds. More then any other dev team withing MS, these guys actually listen
    to what people ask for and say which is why I am so heavily invested in this
    product. With their comitment, I know it will continue to grow to become an
    outstanding product that does what it says on the tin... makes designing and
    building WPF apps faster, smarter and a whole lot more fun!

    Cheers
    --
    Want to learn how to use Blend and visual studio?

    http://www.learnexpressionstudio.com
    http://www.expressionblend.com
    http://www.x-coders.com


    "Meik Schuetz" wrote:

    > Hi Brennon,
    > first of all, thanks for your response. I've got a designer sitting next to
    > me, who'd like to define such conditional storyboards to explain better user
    > interaction to the final decision makers - would be a "nice to have" for us
    > if this could be done directly in Blend.
    >
    > Anyways, how is your book doing? I guess, besides me, there are a bunch of
    > people anxiously waiting for something to have in hands :)
    >
    > Thanks again
    > Best Regards
    > Meik Schuetz
    >
    > "Brennon Williams" wrote:
    >
    > > Howdy,
    > >
    > > There is a concept of multitriggers but I dont think they will fit your
    > > specific purpose in your example.. you can read more from here though:
    > >
    > >
    http://msdn2.microsoft.com/en-us/library/system.windows.multitrigger.aspx
    > >
    > > Sometimes it is just easier to do things in code, or if you really want to
    > > enforce that things are triggered withing the XAML then a series of
    > > dependency properties on your controller object (such as main window) will
    > > allow you to be more judicious in your trigger declarations.
    > >
    > > HTH
    > >
    > > Cheers
    > >
    > > --
    > > Want to learn how to use Blend and visual studio?
    > >
    > >
    http://www.learnexpressionstudio.com
    > > http://www.expressionblend.com
    > > http://www.x-coders.com
    > >
    > >
    > > "Meik Schuetz" wrote:
    > >
    > > > Dear all,
    > > > I’d like to know if and how it is possible to conditionally trigger a
    > > > storyboard in dependency of a user controls property.
    > > >
    > > > Example:
    > > > - Trigger storyboard fadeIn, if button button1 clicked and user control uc1
    > > > is hidden.
    > > > - Trigger storyboard fadeOut, if button button1 clicked and user control uc1
    > > > is visible.
    > > >
    > > > Until now I did this kind of things using C# code, but I’d like to know if
    > > > Blend supports such kind of scenarios (preferencially without coding XAML
    > > > manually).
    > > > Thanks for any information that might be useful.
    > > >
    > > > Best regards
    > > > Meik Schuetz
    > > >
    Saturday, February 23, 2008 12:16 AM