Ambigu type de référence. Un type nommé "VisualState" se produit dans au moins deux espaces de noms

Quelle est l'erreur suivante?

Ambigu type de référence. Un type nommé "VisualState" se produit dans au moins deux espaces de noms, 'Système.Windows' et 'Système.Windows'. Envisager l'ajustement de l'assemblée XmlnsDefinition attributs.

UserControl:

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    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"
    mc:Ignorable="d"
    x:Class="ButtonWPF.MyButtonAdd"
    x:Name="AddButton"
    d:DesignWidth="84" d:DesignHeight="87">
    <UserControl.Resources>
        <Style x:Key="ButtonStyle1" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid x:Name="grid" RenderTransformOrigin="0.5,0.5">
                            <Grid.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                    .............
                                    <Trigger Property="IsDefaulted" Value="True"/>
                                    <Trigger Property="IsMouseOver" Value="True"/>
                                    <Trigger Property="IsPressed" Value="True"/>
                                    <Trigger Property="IsEnabled" Value="False"/>
                                    </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot"
          Height="79"
          Width="72">
        <Button Content=""
                HorizontalAlignment="Left"
                Height="61"
                Style="{DynamicResource ButtonStyle1}"
                VerticalAlignment="Top"
                Width="57"/>
    </Grid>
</UserControl>

MainWindow:

<Window x:Class="ButtonWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
        xmlns:my="clr-namespace:ButtonWPF"
        Title="winGroup"
        Height="637"
        Width="638"
        FontSize="15"
        FontWeight="Bold">
    <Grid>
        <my:MyButtonAdd HorizontalAlignment="Left"
                        Margin="540,519,0,0"
                        x:Name="btnAdd"
                        VerticalAlignment="Top"
                        IsEnabled="True"/>
    </Grid>
</Window>
  • Où exactement le message d'erreur montrer? Je n'ai même pas voir VisualState être utilisé n'importe où dans votre XAML, c'est un peu difficile à déterminer. Mon estimation initiale, cependant, c'est que vous avez peut-être importées deux versions différentes de la DLL pour le System.Windows espace de noms.
  • Mise À Jour De Question
  • Possible en double stackoverflow.com/questions/4913910/...
InformationsquelleAutor mrJack | 2011-08-04