Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1655
Add / Remove Columns in XamDataGrid dynamically
posted
Hi, I want to add and remove columns to/from XamDataGrid Dynamically. I have an IList which is binded to the XamDataGrid. On click of a check box(say Last Name) i want to add the LastName column to the XamDataGrid. (I do not want to hide the column and then show it. It should be added dynamically through code). Similarly if i uncheck the check box, i need to remove the column from the grid. I tried the following statement, it is creating a new column but the values are blank. can you tell me what mistake i am doing? UnboundField LastNameField = new UnboundField(); LastNameField.Name = "Nationality"; LastNameField.Label = "Street"; LastNameField.DataType = typeof(string); this.XamDataGrid.FieldLayouts[0].Fields.Add(LastNameField); Also tell me how to remove the above added column from the grid? Thanks & Regards, Varun R