Can someone show me some working examples of how to programmatically hide a column? I see the gantt.ExecuteCommand(GanttCommandId.HideColumn, object) method, but the api documentation is weak. What kind of object am I supposed to pass to the second parameter? I have tried strings (with the key name of the column), instances of ProjectColumnDefinitions ... etc with no luck.
Does anyone know how to do this? I would think this would be fairly simple to do...
Thanks in advance,
Tim
Hello Timothy,
I have been looking into your post and you need to pass a GanttGridColumn object as second parameter like e.g. :
this.xamGantt.ExecuteCommand(GanttCommandId.HideColumn, new GanttGridColumn("ColumnKey"));
Please let me know, if you need any further assistance on this matter.
Your example doesn't work, for example creating a new GanttGridColumn("Id") won't remove the "Id" column from the grid.
If I select the column from the user Interface first, and then pass in the selected column the GanttCommandId.HideColumn does work, for example, this will work:
IList<GanttGridColumn> selCols = gantt.SelectedColumns;
GanttGridColumn col = selCols[0];
gantt.ExecuteCommand(GanttCommandId.HideColumn, col);
I don't see anyway to return a list of all of the available columns from the XamGantt class, if a method like that existed, I could use the list to remove the "Id" column.
Your example appears to create a new instance of a column (that isn't actually in the existing grid), so the GanttCommand.HideColumn doesn't remove the existing "Id" column from the grid.
I am trying to have my Grid only show the Name, Start and Finish columns on the user interface after it is initialized, what is the best way to do this? I was thinking I would hide the columns I don't want to show, but perhaps there is another (better) way to do this? I see the ColumnSettings Structure, perhaps you could give me an example of how to just display the three columns I mentioned above?