如何获得点击的页眉值 [英] How to get the clicked Header value
问题描述
嗨
I,需要获得Grid标头用户单击的值和类型.我正在使用MVVM模式
I, have a requirment to get the value and type of Grid header user click. I' Using MVVM pattern
请帮助我.
推荐答案
你好,尼克尔,
Hi Nikhil,
当我想修改Datagrid的黑森点击动作时.我扩展了DataGrid(我创建了一个自定义控件)并添加了AddHandlers,以便每次在标头中观察到鼠标单击时都可以.一种可以执行的方法 事件.我的要求略有不同,所以这很有意义,但是您能否在文件背后的代码中根本没有方法?这不会破坏您的MVVB模式-MVVM的用途有所不同.
when I wanted to gwet the hesder click action of a Datagrid. I extended the DataGrid (I created a custom conrtrol) and added AddHandlers so that each time the mouse click was observed in the the header a method would execute to handle the event. I had slightly different requirements so this made sense but could you simply not have a method in your code behind file? This doesn't break youre MVVB pattern - MVVM's purpose is different.
这不是MVVM的一种方式,但是在MVVM中,您的Viewmodel应该只响应数据的更改,而不响应实际的UI事件(例如标题单击等).
Its not a very MVVM way but in MVVM your Viewmodel should only be responding to changes in data not responding to actual UI events such as header clicks etc.
我希望有帮助吗?
这篇关于如何获得点击的页眉值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!