Referencia de tipo ambigua. Un tipo llamado `VisualState` aparece en al menos dos espacios de nombres


¿Cuál es el siguiente error?

Referencia de tipo ambigua. Un tipo llamado 'VisualState' aparece en al menos dos espacios de nombres, 'System.Windows' y 'Sistema.Windows'. Considere ajustar los atributos assembly XmlnsDefinition.

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>

Ventana principal:

<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>
Author: George Lanetz, 2011-08-05

1 answers

Este error(la mayor parte del tiempo de advertencia) se producirá cuando se utilicen dos o más referencias que contengan el mismo espacio de nombres y clases. en su caso está utilizando VisualState que es parte del ensamblaje de PresentationFramework y es posible que haya agregado otro ensamblaje que contiene el mismo objeto " VisualState "con el mismo sistema de espacio de nombres.Windows" .

Puede resolver el error utilizando las siguientes importaciones en su xaml

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

En lugar de usar

<VisualState x:Name="Pressed">
                                        <Storyboard>

                                        </Storyboard>
                                    </VisualState>

Uso:

<vsm:VisualState x:Name="Pressed">
                                    <Storyboard>

                                    </Storyboard>
                                </vsm:VisualState>
 47
Author: Bathineni,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-08-08 08:41:58