【问题标题】:XAML:The attachable property VisualStateGroups was not found in type VisualStateManagerXAML:在 VisualStateManager 类型中找不到可附加属性 VisualStateGroups
【发布时间】:2011-09-01 00:45:52
【问题描述】:

我正在使用 VS2008 EE SP1 + WPF + XAML。 一开始我添加了对它的引用:

xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"

编译时出现此错误:

<vsm:VisualStateManager.VisualStateGroups>  
   <vsm:VisualStateGroup x:Name="CommonStates">
                        <vsm:VisualStateGroup.Transitions>
                            <vsm:VisualTransition To="MouseOver" Duration="0:0:0.1"/>
                            <vsm:VisualTransition To="Pressed" Duration="0:0:0.1"/>
                        </vsm:VisualStateGroup.Transitions>
                        <vsm:VisualState x:Name="Normal"/>
                        <vsm:VisualState x:Name="MouseOver">
                            <Storyboard>
                                <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="Highlight" Storyboard.TargetProperty="Opacity" To="1"/>
                            </Storyboard>

有人知道原因和可能的解决方法吗?

【问题讨论】:

    标签: wpf xaml attached-properties


    【解决方案1】:

    这在 .NET 3.5sp1 WPF 应用程序中不起作用。

    VisualStateManager 和相关类是作为 Silverlight 3 的一部分引入的。它不是 3.5sp1 中 WPF 的一部分,但在版本 4 中被添加到 WPF 中。

    【讨论】:

      猜你喜欢
      • 2013-01-12
      • 2015-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-20
      • 2020-11-08
      • 2015-03-11
      • 1970-01-01
      相关资源
      最近更新 更多