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.
Unfortunately, activation email could not send to your email. Please try again.

Hide Columns in Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

132132 Aug 15,2017 08:49 PM Aug 16,2017 11:40 AM UWP 1
loading
Tags: SfDataGrid
Fritz Switzer
Asked On August 15, 2017 08:49 PM

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);

Gnanasownthari Thirugnanam [Syncfusion]
Replied On August 16, 2017 11:40 AM

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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;