Hi,
I have just started to use the xamDatagrid and would like to hide a field which I want to be able to retrieve as an idenfier of the record displayed. I have defined a field and set the visibility property to False as well as disable the Autocreation of columns. The end result is that I can still see the column in the grid but the content is hidden. How do I completely hide the column that I only want to use to as a data reference ?
Niclas
Hi nlindblo,
You can hide a xamDataGrid field(column) through using both xaml and code.
1. Through xaml:
<igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:Field Name="name" Label="Name" Visibility="Collapsed"/> <igDP:Field Name="department" Label="Department"/> <igDP:Field Name="salary" Label="Salary"/> <igDP:Field Name="email" Label="Email"/> </igDP:FieldLayout.Fields> </igDP:FieldLayout></igDP:XamDataGrid.FieldLayouts>
2. Through code:
xamDataGrid1.FieldLayouts[0].Fields["salary"].Visibility = Visibility.Collapsed;
The attached HideXamDataGridColumn sample application contains a solution based on both the ways.
Best Regards,Yanko
This solution looks like a "code-behind". If the individual is using MVVM this does not elude to the solution.