XAML Designer在Visual Studio 2015中显示自定义行为的错误

时间:2015-12-07 22:23:07

标签: wpf xaml visual-studio-2015 blend

我正在Visual Studio 2015和Blend for Visual Studio 2015中执行我的第一步.XAML设计器无法显示UI的预览并且始终标记所有行为都有错误。为了演示这个问题,我创建了一个解决问题的最小解决方案。我的解决方案只包含一个名为 Test.Ui 的WPF应用程序,(目标.net框架为4.5)。 WPF应用程序引用版本4.5中的Blend Dll: Microsoft.Expression.Interactions System.Windows.Interactivity

行为类实现很少:

namespace Test.Ui
{
    public class MyBehavior : Behavior<Grid>
    {
        protected override void OnAttached()
        {
            base.OnAttached();
        }
    }
}

使用它的XAML如下:

<Window
    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"
    xmlns:local="clr-namespace:Test.Ui"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
    x:Class="Test.Ui.MainWindow"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
        <i:Interaction.Behaviors>
            <local:MyBehavior/>
        </i:Interaction.Behaviors>
    </Grid>
</Window>

Blend和Visual Studio中的设计器都会在行下面显示错误标记,并显示错误消息: &#34;类型&#39; MyBehavior&#39;来自装配&#39; Test.Ui&#39;是使用旧版本的Blend SDK构建的,在Windows Presentation Framework 4项目中不受支持。

请注意,它不是WPF 4项目,而是WPF 4.5,并且应用程序运行正常。它只在设计师中有错误。

我正在使用最新版本的Blend Dlls。 enter image description here

0 个答案:

没有答案