WPF DataGrid:CommandBinding双击而不是使用事件 [英] WPF DataGrid: CommandBinding to a double click instead of using Events

查看:1087
本文介绍了WPF DataGrid:CommandBinding双击而不是使用事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何使用我的DataGrid的MouseDoubleClick事件来抓取所选值,但是如何改用命令绑定呢?这样我的ViewModel可以处理逻辑。

I know how to use the MouseDoubleClick event with my DataGrid to grab the selectedvalue, but how would one go about using command bindings instead? That way my ViewModel can handle the logic.

到目前为止,我有以下内容:

So far I have the following:

<DataGrid Name="TestGrid" Grid.Row="2" Grid.ColumnSpan="2" AutoGenerateColumns="True" MouseDoubleClick="TestGrid_MouseDoubleClick"
          ItemsSource="{Binding Registrations}" SelectedValue="{Binding CurrentRegistration}" IsReadOnly="True" AlternationCount="2" GridLinesVisibility="None">

我想摆脱MouseDoubleClick并适当地替换。

I want to get rid of MouseDoubleClick and replace it appropriately.

推荐答案

你检查过这个 post ,提供整个解决方案...

Have you checked this post, provides entire solution...

这篇关于WPF DataGrid:CommandBinding双击而不是使用事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆