我正在Visual Studio 2015和Blend for Visual Studio 2015中完成我的第一步.XAML设计器无法显示UI的预览并且始终标记所有行为都有错误 . 为了演示这个问题,我创建了一个解决问题的最小解决方案 . 我有一个只包含一个名为 Test.Ui 的WPF应用程序的解决方案(目标.net框架是4.5) . WPF应用程序在版本4.5中引用了Blend Dll: Microsoft.Expression.InteractionsSystem.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中的设计器都会在行下面显示错误标记,并显示错误:“程序集'Test.Ui'中的类型'MyBehavior'是使用旧版本的Blend SDK构建的,而不是Windows Presentation Framework 4项目中支持 .

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

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