The FieldChooser control organizes field headers alphabetically; however, you can change the order of the field headers by setting the FieldChooser control’s FieldDisplayOrder property or by setting its FieldDisplayOrderComparer property. The FieldDisplayOrder property allows you to organize the field headers using two common settings, alphabetical or based on the field order in the DataPresenter control. On the other hand, the FieldDisplayOrderComparer property gives you full control over the organization of field headers within the FieldChooser control. In order to supply your own sorting logic for the field headers in the FieldChooser control, you must create a class that implements the IComparer interface found in the .NET Framework.
For more information on modifying settings exposed by the FieldChooser control, read the topic on working with field chooser settings.
The following example code demonstrates how to change the display order of fields in the FieldChooser control.
In XAML:
<igDP:XamDataPresenter Name="xamDataPresenter1" BindToSampleData="True" FieldChooserOpening="OnFieldChooserOpening"> <igDP:XamDataPresenter.FieldLayoutSettings> <igDP:FieldLayoutSettings HeaderPrefixAreaDisplayMode="FieldChooserButton" /> </igDP:XamDataPresenter.FieldLayoutSettings> </igDP:XamDataPresenter>
In Visual Basic:
Imports Infragistics.Windows.DataPresenter Imports Infragistics.Windows.DataPresenter.Events ... Private Sub OnFieldChooserOpening(ByVal sender As Object, ByVal e As FieldChooserOpeningEventArgs) e.FieldChooser.FieldDisplayOrder = FieldChooserDisplayOrder.SameAsDataPresenter End Sub
In C#:
using Infragistics.Windows.DataPresenter; using Infragistics.Windows.DataPresenter.Events; ... private void OnFieldChooserOpening(object sender, FieldChooserOpeningEventArgs e) { e.FieldChooser.FieldDisplayOrder = FieldChooserDisplayOrder.SameAsDataPresenter; }