当列绑定在代码后面完成时如何触发复选框选中事件?
我有一个数据网格,我在其中在后面的代码中动态创建列。创建列时,我创建关联的单元格模板和单元格编辑模板,以将值转换为布尔值以表示复选框中的数据。一切运作良好。我想做的是用命令来检查事件。我能够通过以下链接在 XAML 中实现此目的,并在
http 后面的代码上执行任何操作://forums.silverlight.net/forums/p/199477/466179.aspx
我将工作 XAML 代码移动到命令后面的代码不会触发。
当我在 XAML 中添加代码并在静态资源类中放置断点时,我可以看到断点被击中。但是当我将相同的代码放在代码后面时,断点不会被击中。我认为当我们应用模板时,静态资源就被解决了。看起来好像不是。
现在,我可以通过监听后端数据来捕捉正在发生的变化。我想通过指挥来实现这一点。
有什么意见或建议吗? 谢谢
I have a data grid, where I create columns on the fly in the code behind. As I create the column, I create associated cell template and cell edit template to convert the value to boolean to represent the data in check box. All works well. What I would like to do is fire check event with commands. I was able to achieve this in XAML with the following link with doing anything on code behind
http://forums.silverlight.net/forums/p/199477/466179.aspx
I moved the working XAML code to code behind the commands are not firing.
When I have the code in XAML and put a break point in the static resource class, I can see break points are hit. But when I put the same code in code behind the break points are not hit. I thought when we do apply template, the static resources are resolved. It looks like it is not.
For now, I able to catch what is changing by listening to back end data. I would like achieve this with commanding.
Any comments or suggestions?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不将一个属性绑定到复选框的 IsChecked 属性。在新属性的设置器中,您可以调用或执行当前使用命令执行的任何方法。
将导致 XAML 不再那么混乱
Why don't you just bind a property to the check box's IsChecked property. And in the setter of the new propery you can call or execute what ever method you are currently executing with the commands.
Will result in less messy XAML