Wpf Xaml中独立程序集中两个名称空间之间的消歧
我正在重新开发一个WPF应用程序,该应用程序使用以下两个程序集,因为它使用每个程序集的单独组件: WPFToolkit和PresentationFramework 在我的Xaml.cs中,我使用了Wpf Xaml中独立程序集中两个名称空间之间的消歧,wpf,xaml,Wpf,Xaml,我正在重新开发一个WPF应用程序,该应用程序使用以下两个程序集,因为它使用每个程序集的单独组件: WPFToolkit和PresentationFramework 在我的Xaml.cs中,我使用了extern alias来使用名称空间System.Windows.TemplateVisualState,这一切都很好,我的问题在我的Xaml.Xaml中,如何区分WPFToolkit.System.Windows.TemplateVisualState和PresentationFramework.S
extern alias
来使用名称空间System.Windows.TemplateVisualState
,这一切都很好,我的问题在我的Xaml.Xaml中,如何区分WPFToolkit.System.Windows.TemplateVisualState
和PresentationFramework.System.Windows.TemplateVisualState
下面是我的Xaml的顶部部分:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CAIS2"
xmlns:CodeLib="clr-namespace:CodeLib;assembly=CodeLib"
xmlns:CAISCommon="clr-namespace:CAISCommon;assembly=CAISCommon" >
这就是Resharper抱怨的地方:
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="LoginStates">
<Windows:VisualState x:Name="LoggedOut">
......
......
看起来您已经为WPF toolkit设置了名称空间,所以您不能这样做:
<toolkit:VisualStateManager.VisualStateGroups>
<toolkit:VisualStateGroup x:Name="LoginStates">
<Windows:VisualState x:Name="LoggedOut">
我对使用
extern alias
方法的后果不太熟悉,因此我不知道这是否会使其失效。Update:实际错误消息如下:类型“System.Windows.VisualStateGroup”存在于两个“c:\程序文件(x86)”中\参考Assemblies\Microsoft\Framework\.NETFramework\v4.0\PresentationFramework.dll”和“c:\Program Files(x86)\WPF Toolkit\v3.5.50211.1\WPFToolkit.dll”我认为这与回答的问题相同[here][1][1]:我必须在另一个命名空间下重新编译WPFToolkit,从而解决了问题:)