Version

Display the Field Chooser

In order for your end users to use the field chooser feature, you must provide a way for your end users to display the FieldChooser control. The DataPresenter controls offer four different ways to display the field chooser.

  1. You can display a field chooser button in the header prefix area above the record selectors by setting a FieldLayoutSettings object’s HeaderPrefixAreaDisplayMode property to FieldChooserButton. However, a DataPresenter control will only display a field chooser button when you also display headers at the top and record selectors on the left or right side of the cell area.

    xamDataPresenter About the Field Chooser 01.png
  1. You can programmatically show the FieldChooser control by invoking the DataPresenter control’s ShowFieldChooser method.

  1. You can execute the ShowFieldChooser command exposed by the DataPresenterCommands class.

  1. You can add an instance of a FieldChooser control to your window and set its DataPresenter property to an instance of a DataPresenter control. For an example of the code required to create an external field chooser, read the topic on Creating an External Field Chooser.

    The following example code demonstrates three different ways to display the field chooser button.

    In XAML:

    <!--Button that executes the ShowFieldChooser command-->
    <!--
    <Button
        Content="Show Field Chooser"
        Command="{x:Static igDP:DataPresenterCommands.ShowFieldChooser}"
        CommandTarget="{Binding ElementName=xamDataPresenter1}" />
    -->
    <igDP:XamDataPresenter Name="xamDataPresenter1">
        <!--You do not have to use the field chooser button if you are displaying the field chooser using a command-->
        <igDP:XamDataPresenter.FieldLayoutSettings>
            <igDP:FieldLayoutSettings HeaderPrefixAreaDisplayMode="FieldChooserButton" />
        </igDP:XamDataPresenter.FieldLayoutSettings>
    </igDP:XamDataPresenter>

    In Visual Basic:

    Imports Infragistics.Windows.DataPresenter
    ...
    Me.xamDataPresenter1.FieldLayoutSettings.HeaderPrefixAreaDisplayMode = HeaderPrefixAreaDisplayMode.FieldChooserButton
    'Calling the DataPresenter control's ShowFieldChooser method
    'Me.xamDataPresenter1.ShowFieldChooser()
    ...

    In C#:

    using Infragistics.Windows.DataPresenter;
    ...
    this.xamDataPresenter1.FieldLayoutSettings.HeaderPrefixAreaDisplayMode = HeaderPrefixAreaDisplayMode.FieldChooserButton;
    //Calling the DataPresenter control's ShowFieldChooser method
    //this.xamDataPresenter1.ShowFieldChooser();
    ...