We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Hide Columns in Grid

Cannot hide the Grid columns using Remove or RemoveAt.  or using the Visible property


Below is my code. 

            
            private ObservableCollection<Patient> patientCollection = new ObservableCollection<Patient>();


            int recCtr = 0;
            var root = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
            using (var db = new SQLite.SQLiteConnection(dbPath))
            {
                try
                {
                    var list = db.Table<Patient>().ToList();
                    foreach (var item in list)
                    {
                        recCtr++;
                        /// Full Patient Table fields displayed
                        patCollection.Add(new Patient() { FirstName = item.FirstName, LastName = item.LastName, Address1 = item.Address1, City = item.City, State = item.State, PostCode = item.PostCode, BirthDate = item.BirthDate });
                    }
                }
                catch { }
            }

            int colCtr = PatientGrid.Columns.Count;

            PatientGrid.ItemsSource = patCollection;
            PatientGrid.Columns.RemoveAt(1);

1 Reply

GT Gnanasownthari Thirugnanam Syncfusion Team August 16, 2017 03:40 PM UTC

Hi Fritz, 

We have checked your query “Cannot hide the Grid columns using Remove or RemoveAt or using the Visible property”. You can able to hide the particular column in SfDataGrid by setting GridColumn.IsHidden property as true as like the below code sample.  

this.dataGrid.Columns[0].IsHidden = true; 

Please refer the below UG link for getting more information about the IsHidden property: 

Sample location: 

Regards, 
Gnanasownthari T. 


Loader.
Live Chat Icon For mobile
Up arrow icon