VisualStateManager supported controls?

Mar 13, 2009 at 10:50 AM
Having had a look at the WPF Themes project on codeplex its become apparent that the VisualStateManager doesn't work for for some controls (I was looking at Expression Dark theme in particualr).

Can some one confirm this and suggest a work around, or changes to the toolkit that i could implement.


The controls which VisualStateManager doesnt work with are scrollbar, slider, tabcontrol/tabitem to name a few.

Any assistance would be appreciated.

Mar 13, 2009 at 12:48 PM
If you don't mind my asking, how is VSM related to themes?  I wasn't aware it was.  Sounds like there is something there I need to look at?
Mar 13, 2009 at 12:58 PM

I was having trouble getting the vsm to work correctly with some controls as listed.

This became apparent when i was trying to use a theme from WPF Themes project on codeplex

The WPF Themes project has example usage of the VSM in the form of styles. try it out for yourself.  Maybe its a problem with that project and not the VSM.

Is there a known issue with VSM not supporting certain controls in WPF?

Mar 13, 2009 at 1:29 PM
In the WPFToolkit I downloaded there is a Themes folder, that is empty.  When I looked around for "WPF Themes", the only thing I find is a listing that seems to contain SilverLight themes.

Where is the project you are trying?
Mar 13, 2009 at 1:40 PM
http://wpfthemes.codeplex.com/

Some of the themes in the WPF Themes project (see above url) are from the Silverlight toolkit but i dont see why some control styles work with vsm and others dont in WPF.
Mar 13, 2009 at 2:32 PM
I notice the following error in the XAML "The attachable property VisualStateGroups was not found in type VisualStateManager. It still compiles though. Any ideas how to fix this ?
Mar 13, 2009 at 3:12 PM
I must have visited that page a hundred times in my research on theming and WPF.  I don't see anything there except some links to silverlight and a bunch of other theme names with no hyperlinks and nothing to download.  What am I missing?
Mar 13, 2009 at 3:15 PM

visit http://wpfthemes.codeplex.com/SourceControl/ListDownloadableCommits.aspx and click download on the latest changeset.
Mar 13, 2009 at 4:38 PM
I'll give that a whack.  How the heck did you find that?

This link:
http://wpfthemes.codeplex.com/

Doesn't seem to have any downloads...
Coordinator
Mar 13, 2009 at 7:40 PM

In order for controls to support VisualStateManager, they need to make GoToState calls. The WPF controls in 3.5 SP1 do not make these calls (since VSM didn't exist then). The Toolkit version of VSM for WPF tacks on these calls automatically for:

  • ButtonBase and derived controls
  • ToggleButton and derived controls
  • ListBoxItem and derived controls
  • TextBoxBase and derived controls
  • ProgressBar and derived controls

This retrofitting occurs when the VisualStateGroups property is set on the root of the control's template.
The "The attachable property VisualStateGroups was not found in type VisualStateManager" error message appears to be a bug in the Visual Studio 2008 designer.

In WPF 4.0, WPF controls will have these GoToState calls natively and fully compatible with Silverlight.

Ben

Mar 16, 2009 at 11:58 AM
Many thanks for the info. It makes sense now.

Although i have started creating behaviour classes for other controls i wonder if the WPF Toolkit plans to support these in future before the relase of .NET 4.0.I guess maybe a question for that project. :o)
Mar 31, 2009 at 9:44 AM
Thanks Ben