Search code examples
c#visual-studio-2010devexpressxtragrid

How can I set visiblity of GridColumn based off value of another GridColumn in the XtraGridControl designer?


I can't seem to find an answer to this question that exists already.

My problem is that I have information on an Employee being displayed in a XtraGridControl with the view set to CardView. In my Employee class I have a Terminated bool property that tells if the employee has been terminated or not. I also have a TerminationDate property that is only valid if the Employee has been Terminated (employee.Terminated == true).

My question is: Is there a way to make the "Termination Date" column hidden if the value of the "Terminated" column is false in the XtraGridControl via the Designer, or do I need to code that?

If I do need to code that, some advice on where to look would be helpful. I'm new to DevExpress.

I'm using version 10.2 of the DevExpress controls, VisualStudio 2010 as my IDE, for the purpose of the program I'm not using a Database as the DataSource I'm using a generic List.

Thanks in advance.

Edit: I should note that I want to do this for an individual card, not disable the Column for all rows.


Solution

  • I managed to get this to work but not by using anything that the GridControl or the View helped with.

    Just to close the question with an answer. I made the DateTime that holds the termination date a nullable DateTime (DateTime?) and then turned on the option in the View to hide columns with null values which hides the Termination Date, this results in the look that I was attempting to achieve.