Version

FieldChooser Class

A control that allows the user to customize which fields are displayed in the data presenter.
Syntax
'Declaration
 
Public Class FieldChooser 
   Inherits Infragistics.Windows.Controls.IGControlBase
public class FieldChooser : Infragistics.Windows.Controls.IGControlBase 
Remarks

FieldChooser displays list of fields that are available for displaying in the data presenter. The user can drag and drop fields between the data presenter and the FieldChooser to show or hide them in the data presenter.

To show a field that's currently hidden, the user can either check the checkbox next to the field in the field chooser or simply drag the field from the field chooser and drop ir anywhere on the data presenter. Note that the the field can be dropped at a specific location inside the field layout area, just like the drag-and-drop functionalty.

To hide a field that's currently visible in the data presenter, the user can either uncheck the checkbox next to the field in the field chooser, or simply drag the field from the data presenter and drop it anywhere outside of the data presenter, including over the field chooser.

You can prevent the user from showing or hiding a specific field by setting the FieldSettings' FieldSettings.AllowHiding property to Never. The field will not be displayed in the field chooser and the user will not be able to hide the field, even by dragging it outside of the data presenter.

Example
The following code snippet sets HeaderPrefixAreaDisplayMode to display the field chooser button in the headers area. It also shows you how to hook into the FieldChooserOpening event to set properties on the FieldChooser that the data presenter will display when the user clicks the field chooser button.

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

    Private Sub Window1_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
        ' FieldChooserButton option displays a button in the headers area where field labels
        ' are displayed, right above the record selectors. This button shows the FieldChooser.
        _dataPresenter.FieldLayoutSettings.HeaderPrefixAreaDisplayMode = HeaderPrefixAreaDisplayMode.FieldChooserButton

        ' Ensure that record selectors are visible otherwise above property setting will not
        ' have any effect. Note that the record selectors are visible by default.
        _dataPresenter.FieldLayoutSettings.RecordSelectorLocation = RecordSelectorLocation.LeftOfCellArea
    End Sub

    Private Sub Dp_FieldChooserOpening(ByVal sender As Object, ByVal e As FieldChooserOpeningEventArgs)
        ' Get the field chooser that's about to be displayed.
        Dim fieldChooser As FieldChooser = e.FieldChooser

        ' Set some properties on it.
        fieldChooser.FieldDisplayOrder = FieldChooserDisplayOrder.Alphabetical
        fieldChooser.DisplayHiddenFieldsOnly = False
    End Sub
using Infragistics.Windows;
using Infragistics.Windows.Controls;
using Infragistics.Windows.Editors;
using Infragistics.Windows.DataPresenter;
using Infragistics.Windows.DataPresenter.Events;

		public void Window1_Loaded( object sender, RoutedEventArgs e )
		{
			// FieldChooserButton option displays a button in the headers area where field labels
			// are displayed, right above the record selectors. This button shows the FieldChooser.
			_dataPresenter.FieldLayoutSettings.HeaderPrefixAreaDisplayMode = HeaderPrefixAreaDisplayMode.FieldChooserButton;

			// Ensure that record selectors are visible otherwise above property setting will not
			// have any effect. Note that the record selectors are visible by default.
			_dataPresenter.FieldLayoutSettings.RecordSelectorLocation = RecordSelectorLocation.LeftOfCellArea;
		}

		private void dp_FieldChooserOpening( object sender, FieldChooserOpeningEventArgs e )
		{
			// Get the field chooser that's about to be displayed.
			FieldChooser fieldChooser = e.FieldChooser;

			// Set some properties on it.
			fieldChooser.FieldDisplayOrder = FieldChooserDisplayOrder.Alphabetical;
			fieldChooser.DisplayHiddenFieldsOnly = false;
		}
        <igDP:XamDataGrid x:Name="_dataPresenter" Grid.Column="1" FieldChooserOpening="dp_FieldChooserOpening" >
            
<igDP:XamDataGrid.FieldLayoutSettings>
                
<igDP:FieldLayoutSettings HeaderPrefixAreaDisplayMode="FieldChooserButton" />
            
</igDP:XamDataGrid.FieldLayoutSettings>            
        
</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