删除 Infragistics webDataGrid BoundCheckBoxField 的部分检查行为
我使用 Infragistics WebDataGrid ,我有 BoundCheckBoxField 列,我想删除部分检查行为。仅选中和取消选中
我在下面的课程中写的,
public class BooleanConverter : IBooleanConverter
{
public BooleanConverter()
{
//
// TODO: Add constructor logic here
//
}
public object DefaultFalseValue
{
get { return false; }
}
public object DefaultTrueValue
{
get { return true; }
}
public bool IsFalse(object value)
{
if (value == null)
return false;
else
return Boolean.Parse(value.ToString());
}
public bool IsTrue(object value)
{
if (value == null)
return false;
else
return Boolean.Parse(value.ToString());
}
}
` 我这样称呼它:
((BoundCheckBoxField)this.uwGrid.Columns["Approval"]).ValueConverter = new BooleanConverter();
‘
但这不是工作。
I used Infragistics WebDataGrid , I have BoundCheckBoxField column, I want remove partial check behavior. only check and uncheck
I wrote following class ,
public class BooleanConverter : IBooleanConverter
{
public BooleanConverter()
{
//
// TODO: Add constructor logic here
//
}
public object DefaultFalseValue
{
get { return false; }
}
public object DefaultTrueValue
{
get { return true; }
}
public bool IsFalse(object value)
{
if (value == null)
return false;
else
return Boolean.Parse(value.ToString());
}
public bool IsTrue(object value)
{
if (value == null)
return false;
else
return Boolean.Parse(value.ToString());
}
}
`
and I call it like this:
((BoundCheckBoxField)this.uwGrid.Columns["Approval"]).ValueConverter = new BooleanConverter();
`
But it is not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
绑定复选框显示绑定到它的任何数据。默认情况下,对于布尔值或可为空布尔值字段,它显示 true 表示已选中, false 表示未选中, null 表示部分。如果您有空数据,这是它应该显示的唯一时间。
如果您不喜欢这种行为,可以为该列分配不同的 ValueConverter。这将是一个实现 IBooleanConverter 的类。您可以使 null 成为选中或未选中状态。
The bound checkbox displays whatever data is bound to it. By default, for a boolean or nullable boolean field, it displays true as checked, false as unchecked, and null as partial. That's the only time it should show up- if you have null data.
If you do not like that behavior, you can assign the column a different ValueConverter. This would be a class that implements IBooleanConverter. You would make it so that null becomes checked or unchecked.
我确信您现在已经弄清楚了,但是您的值转换器类存在一个错误(假设您希望 null 显示为 false)。 IsFalse 方法应该是这样的:
I'm sure you figured it out by now, but there is a bug with your value converter class (assuming you want null to show as false). The IsFalse method should be like this: