![](/img/trans.png)
[英]How do i handle cell double click event on WPF DataGrid, equivalent to windows DataGrid's Events?
[英]How to handle WPF Datagrid double click without using code behind
我們在該項目中使用Views和ViewModels,因此,我們試圖盡可能減少View的代碼隱藏量。
我試圖將WPFToolkit DataGrid
的MouseDoubleClick
事件DataGrid
到已在同一視圖中使用Button
的相同代碼。
Button
聲明如下:
<Button Content="Select" cmd:ButtonBaseExtensions.Command="{Binding CommandViewEmployer}"/>
這意味着它將在ViewModel中運行CommandViewEmployer
屬性。 如何使Grid
MouseDoubleClick
運行相同的屬性? 我嘗試添加MouseDoubleClick="{Binding CommandViewEmployer}"
,但發生錯誤。
我正在嘗試盡可能少地隱藏代碼,最好不要隱藏任何代碼。
您可以使用諸如Marlon Grech 附帶的命令behavior之類的東西 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.