WPF VisualStateManager under Blend 2 SP1 in Windows7?

Feb 6, 2009 at 4:28 PM
I followed the instructions here and modified my registry accordingly. However, I cannot seem to get the VSM to work under blend. VSM enabled controls are working at run-time, but not at design time. At design time I see:

Exception: The tag 'VisualStateManager.VisualStateGroups' does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presenation'.

I am running the public beta of Windows7, 32-bit with all updates installed. I have the appropriate xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit" in the XAML and the Assembly is referencing WPFToolkit.dll, WPFToolkit.Design.dll, and WPFToolkit.VisualStudio.Design.dll. The same code I am using is in a ListBoxItem:

        <Style x:Key="SampleItemContainerStyle" TargetType="{x:Type ListBoxItem}">
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                <Setter Property="Padding" Value="2,0,0,0"/>
                <Setter Property="Template">
                        <ControlTemplate TargetType="{x:Type ListBoxItem}">
                            <Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                        <VisualStateGroup x:Name="SelectionStates">
                                            <VisualState x:Name="Selected">
                                                <Storyboard />
                                            <VisualState x:Name="Unselected">
                                                <Storyboard />
                                        <RowDefinition />
                                        <RowDefinition />
                                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                    <StackPanel x:Name="SelectedActions" Background="Transparent" Visibility="Collapsed">
                                        <Button Content="Some Action" />
                                <Trigger Property="IsSelected" Value="true">
                                    <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                                        <Condition Property="IsSelected" Value="true"/>
                                        <Condition Property="Selector.IsSelectionActive" Value="false"/>
                                    <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
Is this a known issue on Windows7? Has anyone seen this before? Any feedback is appreciated.

Feb 9, 2009 at 9:54 PM
Hi Charlie, I'm not sure if this is a Win7 issue but I'll setup a VM and try it out.  I'll get back to you about this hopefully by the end of the week.

Feb 18, 2009 at 4:11 PM
It appears that it was a problem with the Trial version of Blend 2 SP1. We have licenses at my company, I was just a bit lazy and hadn't installed the real version yet. After installing the official version, everything works fine.
Feb 19, 2009 at 5:50 PM
Hi Charlie,

It's good to hear the issue is resolved.  I was having trouble getting a repro of the problem so I was about to goto the Blend team to see if they've dealt with this before.  If you have any other issues or concerns, we would like to hear about them.

Saied Khanahmadi