日期:2014-05-17  浏览次数:21086 次

WPF ListView如何知道鼠标点击了哪一列
RT,现在需要对ListView上的内容进行过滤,操作员点击某行某列的内容,然后将该列不等于所点击的内容的行删除掉。

请问如何知道鼠标点击的是第几列??

麻烦大家帮帮忙!!

------解决方案--------------------
C# code

public class ProductViewModel
{
    private IProductModel _model;
    public ICollectionView EntityListView { get; private set; }

    [ImportingConstructor]
    public ProductViewModel(IProductModel model)
    {
        this._model = model;
        EntityListView = CollectionViewSource.GetDefaultView(_model.GetProducts());

        if (EntityListView != null)
        {
            EntityListView.CurrentChanged += OnEntityListViewChanged;
        }
    }

    private void OnEntityListViewChanged(object sender, EventArgs e)
    {
        // TODO: add your code here
    }
}