在代码侧编辑指定的datagrid列 [英] Editing specifig datagrid column in codeside

查看:92
本文介绍了在代码侧编辑指定的datagrid列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我有绑定到我的数据收集的datagrid.我代表我的数据槽(DataGridTemplateColumn)数据模板.我添加了事件,我的一些数据模板和事件都在代码中处理.

问题是我如何在该事件中操纵指定的单元格信息.例如,如果我单击启动事件的文本框单元格,则在该事件中,我的方法返回字符串,我需要在指定的文本框单元格中显示它(并且同时将数据也添加到表示该数据网格的数据类中).

希望你有主意:)

干杯!

Hi all!

I have datagrid which is bound to my datacollection. I represent my data trough (DataGridTemplateColumn) datatemplates. I have added events some of my datatemplates and events are handled in code.

The question is that how do I manipulate specifig cell information inside that event. For example if I click textbox cell which launches event, in that event my method returns string and I need to show it in that specifig textbox cell (and ofcource that data is also added into that dataclass which is represented that datagrid)

Hope you got idea :)

Cheers!

推荐答案

您可以使用事件处理程序的参数.

大多数参数是从具有OriginalSource属性的RoutedEventArgs派生的. OrignalSource将具有引发该特定事件的控件.在您的情况下,它将是TextBox(我的猜测,除非您以其他方式实施).
You can use the Event Handler''s argument.

Most of the Arguments are derived from the RoutedEventArgs which has OriginalSource property. The OrignalSource would have the control which raised that particular event. In you case, it would be the TextBox (My guess, unless you have implemented in a different way).


这篇关于在代码侧编辑指定的datagrid列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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