Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4094936
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:49:04+00:00 2026-05-20T19:49:04+00:00

MSDN discourages the use of EventTrigger ‘s and really any custom trigger actions but

  • 0

MSDN discourages the use of EventTrigger‘s and really any custom trigger actions but have offered StoryBoard‘s and the VisualStateManager as alternatives.

Q1. Why are triggers being discouraged when they appear to be so useful?

MSDN’s justification seems to be:

EventTrigger and the object.Triggers
property element usage on elements are
supported by Silverlight, but using
this technique is discouraged for
current applications. EventTrigger can
only support a triggering action for
the Loaded event (you name the event
in the EventTrigger.RoutedEvent
property.
) This makes an EventTrigger
unsuitable for most run-time
interactions.

So, it’s ok to name the VisualState for the VSM but not ok to name the event? Both are string values that can potentially change, so why is the naming of one worse than the other?

Q2. What is the best practice approach to animating an object’s property whose value depends on a property value of its data context?

Sure, VSM and StoryBoard’s are great for animation, but they don’t directly interact with the object’s data context, do they?

Consider the following scenario for discussion:

The border of a Canvas Path should change color and thickness based on the value of an IsSelected property of the Canvas’ data context. Left clicking on the Canvas Path’s enclosed region should toggle the IsSelected property, which should also change the Path’s animation and ultimately color and thickness.


Approach 1

Perhaps I can hook onto the interaction event (i.e. MouseLeftButtonUp) and update the IsSelected property value in the code behind and start a StoryBoard or change the VisualState to animate the Canvas Path. While this may be fine from the animation’s perspective, it strongly couples the view to its view model / data context unless I cast the data context to some IIsSelectable interface.


Approach 2

Perhaps I can create a Behavior that toggles the IISelectable (mentioned above) property and starts the StoryBoard or changes the VisualState. As the Canvas is a Control, it would probably be better to use the VSM rather than just StoryBoard’s (else I would have to somehow pass a reference to the StoryBoard to the Behavior, maybe?).


Approach 3

Perhaps I can use two-way binding with a dual converter so that the initial animation of Canvas Path is determined by the IsSelected property value, but user interactions will change the animation / VisualState which will then update the IsSelected property value. If this is the case, would I convert the Canvas Path’s border color/thickness property or is there a way to properly convert the VisualState (to and from the IsSelected’s boolean value)?


These are just a few ideas off the top of my head. Any other suggestions that would be better practices?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T19:49:05+00:00Added an answer on May 20, 2026 at 7:49 pm

    Q1: EventTrigger and System.Windows.TriggerAction is discouraged. The link you give for “they appear to be so useful?” is for System.Windows.Interactivity.TriggerAction whose use is encouraged because it is supported in Blend SL projects and it can be used for more than just the Loaded event.

    Q2: You can databind an animation’s To value, but I’d consider creating a custom templated control instead. This way you could define that changes to the IsSelected property change the control’s VSM states.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MSDN: Weak references are useful for objects that use a lot of memory, but
MSDN docs say that only value types need boxing, but this does not apply
MSDN says that public static members of System.Windows.Application are thread safe. But when I
The MSDN documentation on WinHttpCrackurl makes a point of saying it runs synchronously. But,
msdn: Any public static (Shared in Visual Basic) members of this type are thread
MSDN You can define a custom function in the storage model by adding a
MSDN is rather vague regarding this attribute. The custom data string can be set
My MSDN subscription provides Expression Blend 4, but not Ultimate. I received a 60
MSDN states that gacutil.exe is not safe to use for production servers . Is
MSDN and numerous post have suggested that BeginPaint/EndPaint should used in WM_PAINT. I've also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.