Version

AllowHiding Property (FieldSettings)

Specifies whether the user can show or hide a field. It also controls whether the field is displayed in the field chooser control.
Syntax
'Declaration
 
Public Property AllowHiding As AllowFieldHiding
public AllowFieldHiding AllowHiding {get; set;}
Remarks

AllowHiding property determines whether the user can show or hide a field. It also controls whether the field is displayed in the field chooser. If set to Never then the field is excluded from the field chooser and the user is not allowed to show or hide the field in any way.

If set to ViaFieldChooserOnly, the user can show or hide a field through the field chooser control only.

If set the Always, in addition to being able to show or hide via field chooser control, the user can hide a field by dragging it outside of the data presenter.

Example
The following code sets AllowHiding on the CustomerID field to Never. As a result the FieldChooser will not display the field in its list of fields and the user will not be able to show the field if it's hidden or hide the field if it's visible.

Imports Infragistics.Windows
Imports Infragistics.Windows.Controls
Imports Infragistics.Windows.Editors
Imports Infragistics.Windows.DataPresenter
Imports Infragistics.Windows.DataPresenter.Events

    Private Sub Dp_FieldLayoutInitialized(ByVal sender As Object, ByVal e As FieldLayoutInitializedEventArgs)
        If Object.Equals(e.FieldLayout.Key, "Customers") Then
            ' Set AllowHiding to prevent the field from being displayed in the field 
            ' chooser. This effectively prevents the user from changing the visibility
            ' of the field.
            e.FieldLayout.Fields("CustomerID").Settings.AllowHiding = AllowFieldHiding.Never
        End If
    End Sub
using Infragistics.Windows;
using Infragistics.Windows.Controls;
using Infragistics.Windows.Editors;
using Infragistics.Windows.DataPresenter;
using Infragistics.Windows.DataPresenter.Events;

		private void dp_FieldLayoutInitialized( object sender, FieldLayoutInitializedEventArgs e )
		{
			if ( object.Equals( e.FieldLayout.Key, "Customers" ) )
			{
				// Set AllowHiding to prevent the field from being displayed in the field 
				// chooser. This effectively prevents the user from changing the visibility
				// of the field.
				e.FieldLayout.Fields["CustomerID"].Settings.AllowHiding = AllowFieldHiding.Never;
			}
		}
        <igDP:XamDataGrid
            
x:Name="_dataPresenter"
            
Grid.Column="1"
        
>
            
<igDP:XamDataGrid.FieldLayouts>

                
<igDP:FieldLayout IsDefault="true">
                    
<igDP:FieldLayout.Fields>

                        
<igDP:Field Name="CustomerID">
                            
<igDP:Field.Settings>
                                
<igDP:FieldSettings AllowHiding="Never" />
                            
</igDP:Field.Settings>
                        
</igDP:Field>

                    
</igDP:FieldLayout.Fields>
                
</igDP:FieldLayout>
            
</igDP:XamDataGrid.FieldLayouts>

        
</igDP:XamDataGrid>
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also