简体   繁体   English

从WPF嵌入式Winforms控件中调用WPF命令

[英]Invoking a WPF command from a WPF-embedded Winforms control

I have a WinDataGrid class that extends from an Infragistics UltraGrid . 我有一个WinDataGrid类,它从Infragistics UltraGrid扩展而来。 I have embedded my WinDataGrid within a WPF usercontrol using WindowsFormHost . 我已经使用WindowsFormHost WinDataGrid嵌入到WPF用户控件中。 When rows are selected, I need to invoke a predefined DelegateCommand<IList> with my collection of selected rows. 选择行后,我需要使用我的选定行集合来调用预定义的DelegateCommand<IList>

How would I go about this? 我将如何处理?

As background, I have a WPF app that uses both a WPF DataGrid and an Infragistics WinGrid. 作为背景,我有一个同时使用WPF DataGrid和Infragistics WinGrid的WPF应用程序。 The WPF grid is already mostly wired up, and I want to utilize the existing commands etc as much as possible in wiring up my Winforms grid. WPF网格已经大部分连接了,我想在连接Winforms网格时尽可能多地利用现有命令等。 I realise there may be some mapping required, but figure I should be able to map most things? 我意识到可能需要一些映射,但是图我应该能够映射大多数东西?

If DelegateCommand is an ICommand you can call the Execute() method to invoke the command. 如果DelegateCommandICommand ,则可以调用Execute()方法来调用命令。 Don't forget to first check if the command is allowed to execute with CanExecute() 不要忘记首先检查是否允许使用CanExecute()执行命令

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM