在Xaml中的单独程序集中消除两个名称空间之间的歧义

时间:2012-06-14 13:14:10

标签: wpf xaml

我正在重新开发一个WPF应用程序,该应用程序使用以下两个程序集,因为它使用了每个程序集中的单独组件:

WPFToolkit和PresentationFramework。

在我的Xaml.cs中,我使用extern alias来使用命名空间System.Windows.TemplateVisualState,这一切都很好,我的问题在于我的Xaml.xaml,我如何区分{{1 }和WPFToolkit.System.Windows.TemplateVisualState

以下是我的Xaml的顶部:

PresentationFramework.System.Windows.TemplateVisualState

这里是Resharper抱怨的地方:

 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"  >

1 个答案:

答案 0 :(得分:0)

看起来您已经为WPF工具包设置了名称空间,所以你不能这样做:

<toolkit:VisualStateManager.VisualStateGroups>
    <toolkit:VisualStateGroup x:Name="LoginStates">
        <Windows:VisualState x:Name="LoggedOut">

我对使用extern alias方法的后果不太熟悉,因此我根本不知道这是否会使此无效。