(WPF Datagrid)如何确定项目的列索引 [英] (WPF Datagrid) How do I determine the Column Index of an Item

查看:130
本文介绍了(WPF Datagrid)如何确定项目的列索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击单元格
时,我正在使用Visual Studio 2010 / VB.Net,如何返回WPF Datagrid中某个项目的列索引?

How do i return the column index of an item within a WPF Datagrid, when I click on a cell I'm using Visual Studio 2010/VB.Net

推荐答案

您可以直接使用下面的代码来获取所选单元格的列索引。

You can use below code directly to get selected cells column index.

int index = datagrid.SelectedCells[0].Column.DisplayIndex;

这篇关于(WPF Datagrid)如何确定项目的列索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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