我有一个datagrid,我在其中声明了一个带有组合框的模板。我的第一个想法是在PreparingCellForEdit上触发一个Interaction.Trigger,但是带有组合框的template列没有触发它。我尝试将交互触发器放在组合框上,但它甚至不能触发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>你知道如何在组合框的下拉列表打开之前为我的命令触发一个事件吗?
谢谢你,安德里亚
发布于 2018-06-12 15:22:35
我相信我们在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
https://stackoverflow.com/questions/50802811
复制相似问题