locked
Missing visual states?

    Question

  • If you select a Button on the design surface and choose Edit Template, Create Empty, Visual Studio creates a skeleton VisualStateManager, but it doesn't include the Normal state in the CommonStates group or the Unfocused state in FocusStates group. Equivalent states seem to be missing for other controls.

    The pattern I use for building control templates is to define the normal, unfocused state in the template, and then use the VisualStateManager to specify visual behavior for the other states. I think that's pretty typical, but it means I always have to add the Normal and Unfocused states to the VisualStateManager to get the rollback behavior.

    It's a minor nuisance, but it makes me wonder why these "default" visual states aren't included to begin with in the VisualStateManager. Am I missing something here? Is there something wrong with the pattern I use?


    Rebecca M. Riordan


    Tuesday, February 12, 2013 3:33 PM

Answers

  • For those who may be interested...per my email conversation with Harikrishna Menon, this behavior has been "changed" (he rather carefully avoided saying "fixed") in Update 2, which is currently in CTP.

    Rebecca M. Riordan

    Tuesday, February 12, 2013 10:21 PM

All replies

  • Hi Rebecca,

                      If you do the same operation in Blend. You can see that we generate these states in the states panel. If you make a change to any of these states , we then serialize these states into the Markup. This is slight change in behavior from Blend4 (Where just selecting the state would serialize it into markup). This support is not available in the Edit Template command in Visual Studio. Also please install VS Update 2 http://support.microsoft.com/kb/2797912?wa=wsignin1.0 , we made a bunch of fixes in this area as well.


    Dev@Mic

    Tuesday, February 12, 2013 5:49 PM
  • I'm sorry, but describing Blend's behavior is not in any way an answer to a question regarding the behavior of Visual Studio and control template code patterns. And VS studio is reporting no available updates.

    Look, I'm trying to be polite here. This seems like a bug to me, but before I declare it one (and describe it as such in the book I'm writing for Pearson), I'm asking whether there's a reason for the behavior.


    Rebecca M. Riordan

    Tuesday, February 12, 2013 6:47 PM
  • I think he did answer the question, just in the middle of the text, maybe he can clarify:

    "This support is not available in the Edit Template command in Visual Studio."

    Tuesday, February 12, 2013 7:04 PM
  • Come on guys, work with me here, will you?

    I know it's not available. I wouldn't have posted in the first place if it were. I'm asking whether there's a reason.


    Rebecca M. Riordan

    Tuesday, February 12, 2013 7:14 PM
  • I don't personally know, but I can help you get in touch with the right people. Either provide contact info here or send me an email at first.last@microsoft.com (using my name) and I forward it to someone who can answer this and future questions.
    Tuesday, February 12, 2013 7:18 PM
  • Thanks, Chuck, email on it's way.

    Rebecca M. Riordan

    Tuesday, February 12, 2013 7:35 PM
  • For those who may be interested...per my email conversation with Harikrishna Menon, this behavior has been "changed" (he rather carefully avoided saying "fixed") in Update 2, which is currently in CTP.

    Rebecca M. Riordan

    Tuesday, February 12, 2013 10:21 PM
  • Thanks for the update.

    Min Zhu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, February 14, 2013 9:07 AM
    Moderator