如何使用Silverlight禁用网格中的复选框 [英] how to disable check box in grid using silverlight

查看:72
本文介绍了如何使用Silverlight禁用网格中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我担心SilverLight.我的项目有一个问题.也就是说,我在运行时在gridview中生成了复选框.现在,当我选中复选框时,必须启用false.

请尽快帮帮我.

Hello,

I am woring on SilverLight. I have one problem in my project. That is, I have generated checkboxes in gridview at runtime. Now I have to enable false when I Check check box.

Please, Help me ASAP.

推荐答案

我从声明中假设,您已经将复选框直接添加到了gridview. 更好的选择是将gridview绑定到某种数据源-自定义类或您控制的实体集.
在gridview的xaml中,为用于定义所需内容的项模板创建一个数据模板,然后将复选框的启用状态绑定到所需的任何属性.

如果该属性位于主视图模型上,则可以使用元素到元素的绑定来获取它.

但是,直接添加复选框意味着每次都必须直接向该复选框添加绑定.这不可能,只是不太好:)
只需在代码中创建一个新的Binding并将其设置为Checkbox的EnabledProperty.

哦,我们都在这里为您提供帮助.我们不在这里工作,而是免费这样做.将事物标记为ASAP并不是获得该帮助的好方法.
I assume from the statement, that you have directly added the checkboxes to the gridview.
A better alternative is to bind the gridview to a datasource of somekind - custom class, or entity set that you control.
In the gridview, in the xaml, create a datatemplate for the item template that defines what you require, and bind the enabled state of the checkbox to whatever property you require.

If that property is on your main viewmodel, you then have the ability to use element to element binding to get to it.

However, adding checkboxes directly would mean having to add a binding directly to the checkbox evertime. Which isn''t possible, just not very nice :)
Just create a new Binding in the code and set it to the EnabledProperty of the Checkbox.

Oh, and we are all here to help. We do not work here and are doing this for free. Marking things as ASAP is not a good way to get that help.


这篇关于如何使用Silverlight禁用网格中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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