隐藏silverlight数据网格中特定行中的按钮,基于该行中的其他值 [英] Hiding button in a particular row in silverlight data grid, based on other values in that row

查看:80
本文介绍了隐藏silverlight数据网格中特定行中的按钮,基于该行中的其他值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个silverlight数据网格,其中一列有按钮。现在我想根据特定行中的其他值设置这些按钮的可见性。请让我知道如何在Silverlight MVVM中实现这一点。提前致谢。 。 。

Hello everyone,

I am having a silverlight datagrid, in which one column is having buttons. Now i wanted to set visibility of these buttons based on other values in a particular row. Please let me know how to achive this in Silverlight MVVM. Thanks in advance. . .

推荐答案

由于当前行按钮的可见性取决于同一数据网格中其他行的值,因此最好以包含一个以上的方式组合对象这些按钮的可见性属性。因此,当您从源获取数据时,请执行条件检查或逻辑以填充visibility属性。将列表一次绑定到数据网格。



例如:

您是绑定列表< employee>对象数据网格。

再向Employee类添加一个属性

public class Employee

{

.. ..

public bool ButtonVisibility {get;组; }

....

}

当你得到雇员名单时,你可以检查并填写该字段。

将完整列表绑定到datagrid。





希望这对您有所帮助。
As the visibility of Current Row buttons depends on the values of other rows in same datagrid, its better to compose your object in such a way that include one more property for visibility of these buttons. So as and when you get data from the source, do your condition check or logic to populate the visibility property. Bind the list at once to the datagrid.

For ex:
You are binding List<employee> object to datagrid.
Add one more property to the Employee class
public class Employee
{
....
public bool ButtonVisibility { get; set; }
....
}
As and when you get the list of employess do your condtion check and populate the field.
Bind the complete list to datagrid.


Hope this will help you.


这篇关于隐藏silverlight数据网格中特定行中的按钮,基于该行中的其他值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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