wpf - Interaction.Triggers 数据模板列 WPF
问题描述
我有一个数据网格,我在其中声明了一个带有组合框的模板列。我的第一个想法是在 PreparingCellForEdit 上触发 Interaction.Trigger,但是带有组合的模板列没有触发它。我试图将交互触发器放在组合上,它甚至没有触发 DropDown
<WPFCtrlD:ExtDataGridTemplateColumn Header="{x:Static Translate:Translate.About}" Width="*" Tag="ID_SAP_MAPPING"
IsReadOnly="False" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<!--Visibility="{Binding IsClassSelected, Mode=OneWay, UpdateSourceTrigger=PropertyChanged,
Converter={StaticResource BoolToVisibilityCollapsedInverteConverter }}"-->
<ComboBox ItemsSource="{Binding DataContext.characteristicFiltered,
Source={StaticResource ProxyElement}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged }"
SelectedValuePath="ID_SAP_NAME"
DisplayMemberPath="ID_SAP_NAME"
>
<i:Interaction.Triggers>
<i:EventTrigger EventName="DropDown">
<WPFCtrl:EventToCommand
PassEventArgsToCommand="True"
Command="{Binding DataContext.PreparingCellForEditCommand, Source={StaticResource ProxyElement}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>
<!--<Label Visibility="{Binding IsClassNotSelected, Mode=OneWay, UpdateSourceTrigger=PropertyChanged,
Converter={StaticResource BoolToVisibilityCollapsedInverteConverter }}"/>-->
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</WPFCtrlD:ExtDataGridTemplateColumn>
在组合的下拉菜单打开之前如何为我的命令触发事件的任何想法?
谢谢安德里亚
解决方案
我相信我们在 WPF 中使用的 ComboBox 来自使用DropDownOpened事件的 System.Windows.Controls 命名空间。
另一方面,如果您使用 System.Windows.Forms 命名空间中的 ComboBox,它会使用DropDown事件。
来源:https ://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.dropdown(v=vs.110).aspx
推荐阅读
- sql - 在列中查找值之前和之后的值
- java - Postgresql 11:存储过程调用错误 - 要调用过程,请使用 CALL、Java
- laravel - Laravel mongodb 使用 where 查询获取记录非常慢
- android - Android Yandex Mapkit 按点或按名称搜索请求总是返回空值,为什么?
- json - 我必须使用 ffmpeg 将我的视频中的所有图像、背景、图层等列为 json 文件
- html - 关于使整个 div 可点击(角度)的 HTML 问题
- pine-script - ATR 自定义 Pine 脚本
- c# - Jquery Datatable 主题不可见
- javascript - 由于 React-bootstrap 验证,settimeout 不起作用
- c++ - 由于并发写入,在嵌套循环崩溃中使用 omp parallel?