Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

VGridOptionsBehavior.AllowRecordComparison Property

Gets or sets whether record comparison is enabled.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.2.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid

#Declaration

[DefaultValue(true)]
[XtraSerializableProperty]
public virtual bool AllowRecordComparison { get; set; }

#Property Value

Type Default Description
Boolean true

true to allow users to compare records; otherwise, false

#Property Paths

You can access this nested property as listed below:

Object Type Path to AllowRecordComparison
VGridControlBase
.OptionsBehavior .AllowRecordComparison

#Remarks

The VGridControl allows you to compare records if the AllowRecordComparison property is set to true.

Checkboxes appear when users hover the mouse pointer over record headers. Use checkboxes to add or remove records to/from the comparison. Another way to do this is to right-click record headers and choose Add to Comparison and Remove from Comparison.

To display the comparison, right-click the record header and choose Show Comparison from the context menu. Choose other options in the context menu like Hide Comparison and Clear Comparison to hide or clear the comparison.

#Compare Records

To allow users to compare records, follow the steps below:

Show Record Headers

#Example

The following example toggles the AllowRecordComparison property:

private void btnToggleComparison_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
    vGridControl1.OptionsBehavior.AllowRecordComparison = !vGridControl1.OptionsBehavior.AllowRecordComparison;
}

#Disable the Record Header Context Menu

To disable the header menu, set the EnableRecordHeaderMenu property to false.

#Compare Records in Code

Use the following methods to compare records:

The following example code shows how to display record headers, add records to the comparison collection, and display the comparison:

using DevExpress.Utils;
using DevExpress.XtraVerticalGrid;

private void Form1_Load(object sender, EventArgs e) {
    // Display record headers.
    vGridControl1.OptionsView.ShowRecordHeaders = true;
    // Display FirstName and LastName field values in record headers.
    vGridControl1.RecordHeaderFormat = "{FirstName} {LastName}";
    // Add records to the comparison collection.
    vGridControl1.AddToComparison(4); 
    vGridControl1.AddToComparison(5);
    vGridControl1.AddToComparison(7);
    // Display the comparison
    vGridControl1.ShowComparison();
}   

Select records and show comparison

See Also