wpf VisualState 与 wpfToolkit 冲突?
我正在 VS2010 中构建一个应用程序,使用 wpfToolkit 3.5 作为引用程序集。
我尝试从 ExpressionBlend 4 添加一些 VisualStates,但在尝试构建项目时收到以下错误。
类型“System.Windows.VisualState” 存在于两个“c:\Program Files”中 (x86)\参考 程序集\Microsoft\Framework.NETFramework\v4.0\PresentationFramework.dll' 和 'c:\Program Files (x86)\WPF 工具包\v3.5.50211.1\WPFToolkit.dll'
这是我也尝试过的代码
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ShowHideRoomNumber">
<VisualState x:Name="Show"/>
<VisualState x:Name="Hide">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="comboBox">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Hidden}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
,但出现了同样的错误
xmlns:vsm="clr-namespace:System.Windows;assembly=WPFToolkit"
<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="ShowHideRoomNumber">
<vsm:VisualState x:Name="Show"/>
<vsm:VisualState x:Name="Hide">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="comboBox">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Hidden}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>
有什么建议吗?
谢谢
I am building an application in VS2010 with wpfToolkit 3.5 as referenced assembly.
I tried to add some VisualStates from ExpressionBlend 4 and I am getting the following error when I am trying to build the project.
The type 'System.Windows.VisualState'
exists in both 'c:\Program Files
(x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.0\PresentationFramework.dll'
and 'c:\Program Files (x86)\WPF
Toolkit\v3.5.50211.1\WPFToolkit.dll'
this is the code
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ShowHideRoomNumber">
<VisualState x:Name="Show"/>
<VisualState x:Name="Hide">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="comboBox">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Hidden}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
I tried also and this but the same error occured
xmlns:vsm="clr-namespace:System.Windows;assembly=WPFToolkit"
<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="ShowHideRoomNumber">
<vsm:VisualState x:Name="Show"/>
<vsm:VisualState x:Name="Hide">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="comboBox">
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Hidden}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>
Any suggestions?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这就是外部别名的用途
http://msdn.microsoft.com/en-us/library/ms173212.aspx
您可以通过 Visual Studio 进行设置,方法是
This is what extern alias is for
http://msdn.microsoft.com/en-us/library/ms173212.aspx
You can set this up through Visual studio by
我解决这个问题的方法是在此处获取源代码的副本,并修改它,使 VisualStateManager 和相关类位于不同的命名空间中(我选择 System.Windows.VSM) 这有点痛苦,但它会起作用。我预计 VSM 将从工具包的未来版本中删除,但我无法证明这一点。
同时,您还可以做一些其他事情,但每件事都有点痛苦+可能不起作用,具体取决于您的情况。
The way that I have resolved this problem is to get a copy of the source code here, and modify it so that the VisualStateManager and related classes are in a different namespace (I chose System.Windows.VSM) It is kind of a pain, but it will work. I expect that the VSM will be removed from future versions of the toolkit but I can't prove it.
Meanwhile, there are a couple of things other that you can do, and each of them are kind of a pain + probably won't work, depending on your case.