WPF xmlns 用于别名程序集?

发布于 2024-09-11 07:47:31 字数 685 浏览 2 评论 0原文

我试图通过将 DLL 从 Silverlight 平台引入 WPF 来访问 System.Windows.VisualStateManager。它是 System.Windows.dll,它与另一个 dll(我相信是 WindowsBase.dll)冲突,所以我给了程序集一个别名来解决那里的复杂问题。在我的后面的代码中,我可以访问我需要的所有类/枚举/什么,但我需要将 VisualStateGroups 添加到我的页面的 XAML。所以我添加了这个:

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

我需要这些元素:

<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="DragCue">
<vsm:VisualState x:Name="NoDrop">

问题是 vsm 似乎是 WindowsBase.dll 中的命名空间的别名。无论它真正在做什么,它都不允许我访问 VisualStateManager,我可以在后面的代码中成功引用它,并且已在测试项目中成功访问以确保它有效。它应该像复制东西一样简单...有没有办法明确地说我只希望 xmlns:vsm 指向特定别名类之外的名称空间?

I'm trying to access System.Windows.VisualStateManager by bringing in a DLL from the Silverlight platform into WPF. It's System.Windows.dll and it conflicts with another dll (WindowsBase.dll I believe) so I gave the assembly an alias to sort out complications there. In my code behind I can access all the classes/enums/what-not that I need but I need to add VisualStateGroups to the XAML of my page. So I added this:

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

I need that for these elements:

<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="DragCue">
<vsm:VisualState x:Name="NoDrop">

The problem is that vsm seems to alias the namespace in WindowsBase.dll. What ever it really is doing, it's not letting me access VisualStateManager, which I can successfully reference in code behind, and have successfully accessed in a test project to make sure it worked. It should have been as easy as just copying things over... Is there a way to explicitly say I only want xmlns:vsm to point to a namespace out of a particular aliased class?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

她说她爱他 2024-09-18 07:47:31

我意识到这个主题很旧,您可能已经找到了解决方案,但出于好奇,为什么您需要引入不同的视觉状态管理器? WPF 提供了一种我认为与 Silverlight 几乎相同的功能,而 Silverlight 只提供了一些与 Web 相关的功能。

I realize this topic is old, and you may have found a fix, but out of curiosity, why do you need to bring in a different Visual State Manager? WPF provides one that I thought was almost the same as Silverlight, and the Silverlight one just had some web related stuff going on.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文