autocad
wpf
communitytoolkit.mvvm
combobox选定项变化事件
安装 Microsoft.Xaml.Behaviors.Wpf包 使用命名空间 xmlns:i="http://schemas.microsoft.com/xaml/behaviors" 那么comobox应该是 <ComboBox ItemsSource="{Binding Items}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding SelectionChangedCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>
程序能够顺利生成,
但在AutoCAD中无法打开窗体,
提示:未能加载文件或程序集“Microsoft.Xaml.Behaviors”或它的某一个依赖项
经过搜索,
找到这篇文章
@Jebarson Jebarson on Feb 4, 2021 This a repro for me. It happens when the Page is in a class library. The easiest workaround is to name behavior command in the xaml. <Behaviors:InvokeCommandAction x:Name="SelectionCommand" Command="{Binding SelectedItemsChangedCommand}"
一个简单的变通方法是给一个name,
按照上面的方式修改后,
autocad中顺利弹出相应窗口,
combobox工作正常。
标签:Behaviors,autocad,Xaml,程序,Microsoft,加载 From: https://www.cnblogs.com/myzw/p/18539598