Question

Is there a way to set the visual state of a control during design time in Miscrosoft Blend ?

(For example setting the state of a TextBox to "Disabled" so that one can see the disabled TextBox on the design surface)

Thanks in advance :)

Was it helpful?

Solution

Right click your TextBox and choose "Edit Template" -> "Edit A Copy" and break the template out into a resource dictionary or wherever you like, generally a new resource dictionary is a good place. This will take you to the template for that control, then click the "States" tab (Normally top left corner in blend) and it will reveal the various states of your control including disabled and expose the objects that create your control.

All this stuff is also of course found in your VisualStateManager code, but looking at the states in the template is the easiest route with visual interpretations of the states viewable as you click them. As you click around the states notice the little red dots that appear on your objects in your objects & timeline panel to see what elements are being interacted with per that state. Makes things much easier. Hope this helps, if not define further and we'll get ya set up right. Cheers Marc. :)

OTHER TIPS

What I usaly does, using MVVM, is to bind the state I wish to control to a propertie in my ViewModel. I use MVVMLight as my MVVM framework, there you got a "IsInDesignMode" propertie which you can check agains, and set your desired design time properties.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top