Click here to Skip to main content
15,900,589 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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. . .

1 solution

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.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900