Wpf XAML设计器在Visual Studio 2015中显示自定义行为错误
我正在Visual Studio 2015和Blend for Visual Studio 2015中完成我的第一步。XAML设计器无法显示UI预览,并不断标记所有有错误的行为。为了演示这个问题,我创建了一个呈现问题的最小解决方案。我有一个解决方案,它只包含一个名为Test.Ui的WPF应用程序(目标.net framework是4.5)。WPF应用程序引用了Blend DLL:Microsoft.Expression.Interactions和System.Windows.Interactivity,这两个版本都在4.5版中 行为类实现是最小的:Wpf XAML设计器在Visual Studio 2015中显示自定义行为错误,wpf,xaml,visual-studio-2015,blend,Wpf,Xaml,Visual Studio 2015,Blend,我正在Visual Studio 2015和Blend for Visual Studio 2015中完成我的第一步。XAML设计器无法显示UI预览,并不断标记所有有错误的行为。为了演示这个问题,我创建了一个呈现问题的最小解决方案。我有一个解决方案,它只包含一个名为Test.Ui的WPF应用程序(目标.net framework是4.5)。WPF应用程序引用了Blend DLL:Microsoft.Expression.Interactions和System.Windows.Interactiv
namespace Test.Ui
{
public class MyBehavior : Behavior<Grid>
{
protected override void OnAttached()
{
base.OnAttached();
}
}
}
namespace Test.Ui
{
公共类MyBehavior:行为
{
受保护的覆盖无效附加()
{
base.onatached();
}
}
}
使用它的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项目中不受支持
请注意,它不是WPF4项目,而是WPF4.5,并且应用程序运行良好。它只在设计器中有错误
我使用的是Blend DLL的最新版本。
我能够重现您的问题,但只有在我引用4.0.0.0版本的System.Windows.Interactive时。当我引用4.5.0.0版本的S.W.Interactive时,一切似乎都很好。简而言之,您概述的问题在您指定的条件下是不可重现的。我面临着相同的问题。问题解决了吗?