我一直在尝试在WPF窗口上实现一个行为,因此我在当前解决方案中添加了对System.Winodws.Interactivity的引用,然后编写了所需的行为。但是为了应用此行为,我必须在Windows XAML中编写如下内容:
<Window x:Class="WpfApplication5.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
xmlns:behav ="clr-namespace:WpfApplication5"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity;assembly=System.Windows.Interactivity">
<Window.Resources>
<i:Interaction.Behaviors>
<behav:DialogIconRemoveBehavior></behav:DialogIconRemoveBehavior>
</i:Interaction.Behaviors>
</Window.Resources>
<Grid>
</Grid>
</Window>
但是这不是有效的标签,因为除了System.Windows.Interactivity之外,我可能还需要添加对任何其他程序集的引用。因此,请建议我在XAML中使用标签需要做什么。
http://schemas.microsoft.com/xaml/behaviors
(之前是您问题中提到的http://schemas.microsoft.com/expression/2010/interactivity
)。 - mins