Behavior and state change RRS feed

  • Question

  • Hi,

    Does anybody know, is it possible to fire state change from the behavior?

    What I am trying to do: i ve created behavior for the panel object and bound this behavior to the canvas. In the behavior i am searching for children of the AssociatedObject and binding mouseLeftButtonUp event to each of them:

     void child_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
                if (state)
                    VisualStateManager.GoToState((Control)sender, "StateDown", true);
                    VisualStateManager.GoToState((Control)sender, "StateDown", true);
                state = !state;

    I am not sure this is correct way.. no, actually i know that it is incorrect, but cannot figure out why.

    Most probably the problem in (Control)sender casting.. but the control can be whatever control.. so.. need help..

    Friday, July 9, 2010 11:53 AM

All replies

  • Is this something that cannot be done using the built-in GotoStateAction? I would imagine that you would able to achieve some of this using the built-in event triggers and gotostateaction?


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, July 9, 2010 6:13 PM
  • That is possible, I just started to learn silverlight few days ago, and i dont know all the functionality and tricks "how to.." in expression blend.. The worst thing, that i never worked with such a technologies, even with flash.

    Do you know some good tutorials that can explain Triggers and behaviors.. maybe videos... 

    I was reading yesterday about behaviors for example.. Maybe again I am wrong, but as I understood, the easiest way to implement one, is to generate xaml using expression blend, for example some animation, and then rewrite the code in behavior file.. am i right?



    Saturday, July 10, 2010 8:16 AM
  • Sunday, July 11, 2010 6:12 PM