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
close icon

Hide and Show Column

Hi, i need to hide and show a column in a Datagrid in Xamarin Forms. For hide i use the sentence dataGrid.Columns["name"].Width = 0 , but when it shows, not working when assign a value mayor that 0 and I can't show more the column.

Regards

3 Replies

VP Vimal Prabhu Manohkaran Syncfusion Team March 14, 2017 04:10 AM UTC

Hi Andy,

Thanks for contacting Syncfusion support. SfDataGrid supports hiding and unhiding of columns from the 2017 Volume 1 Main Release ( version 15.1.0.33) . Please refer the following code snippet to achieve your requirement.

 
// Hide a colum 
this.dataGrid.Columns[0].IsHidden = true; 
GridTextColumn column = new GridTextColumn(); 
column.IsHidden = true; 
 
//UnHide a column 
this.dataGrid.Columns[0].IsHidden = false; 
column.IsHidden = false; 

Regards,
Vimal Prabhu
 



JI Jonathan Ismaila May 2, 2021 04:31 PM UTC

Why duplicating codes that mean same?
Syncfusion should eliminate the second command as it is unnecessary.
this.grid.Columns[0].IsHidden = true; should be enough ti give us the desired result.

Thanks.


KK Karthikraja Kalaimani Syncfusion Team May 3, 2021 01:19 PM UTC

Hi Jonathan,

The direct IsHidden property implemented for MVVM pattern and DataGrid.Columns[0].IsHidden is implemented for C# based architecture. So, we can use based on the architecture.

Regards,
Karthik Raja
 


Loader.
Live Chat Icon For mobile
Up arrow icon