.XAML mouse events IN .XAML RRS feed

  • Question

  • Dear Silverlighters; In the spirit of not writing code unless absolutely required, how can I wire up XAML event storyboards to XAML triggers (MouseEnter="{staticResource MyVisualGroup.CommonEvent.MyMouseEnter}". I know I have the syntax wrong; i can't seem to get x:Name="MyMouseEnter" storyboard trigger to respond to the XAML event; it wants linkage to an external VB or C#/CS. The intellitype feature keeps complaining with squiggly underscoring that it can't find the object. How can I see where it is searching (search path ? resource path ?). What other resources are there ? Where are the docs for stuff inside the quotes and inside the curley braces ? Finally, it would seem that this kind of linkage should be doable in expression blend. Why when I define events i should see default events to attach to a timeline gizmo. How can I have multiple responses in a trigger (default + other action, such as logging mouse events). dB Dr. K (urley)
    Tuesday, November 3, 2009 7:43 PM


All replies

  • Hi Dr. K,

    Silverlight XAML 'triggers' don't work as they do in WPF. In silverlight you have to use the VisualStateManager, and even then you can only manipulate the state of the UI (start and stop animations, change colors, transforms, etc). To do anything else you will need to respond to events (such as the click event for a button) in the code behind. I would suggest that for changing the UI, use the VisualStateManager. For most other things, use events.

    I'd google the VisualStateManager and when and where it can be used vs. the routed event system. Be aware that WPF and Silverlight are very different when it comes to triggers/visual states. Not that I'm bitter about that at all.... ;-)


    Wednesday, November 4, 2009 6:21 AM
  • Hi dr,

    I understand you just don't want to write one code line to create animation and fire it by element event.

    Please check my post here



    Friday, November 6, 2009 1:10 AM