Skip to main content

LayoutItemDifferenceType Enum

Identifies card field settings that can be modified via the LayoutView.CustomCardLayout event.

Namespace: DevExpress.XtraGrid.Views.Layout

Assembly: DevExpress.XtraGrid.v24.1.dll

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

Declaration

public enum LayoutItemDifferenceType

Members

Name Description
SelectedTabIndex

Identifies the selected page index. The value for this setting must be of the Integer type. 0 corresponds to the first tab, 1 corresponds to the second tab, etc.

GroupExpanded

Identifies the group expansion state. A value for this setting must be of the Boolean type, where true indicates that the group is expanded and false indicates the group is collapsed.

ItemVisibility

Identifies the item’s visibility. A value for this setting must be of the Boolean type, where true indicates that the item is visible and false indicates that the item is hidden.

Example

The following example shows how to customize the layout of fields in cards via the LayoutView.CustomCardLayout event.

A card in the example contains a Photo field and a Contact Info group. In the event, the Photo field is only displayed in cards if a showPhoto flag is set. The Contact Info group is only displayed in the focused card; in other cards it’s hidden.

The result is shown below:

LayoutView_CustomCardLayout_Ex

using DevExpress.XtraGrid.Views.Layout.Events;
using DevExpress.XtraLayout;

// Indicates whether to display the Photo field in cards.
bool showPhoto = true;

void layoutView1_CustomCardLayout(object sender, LayoutViewCustomCardLayoutEventArgs e) {
    // The name of the LayoutViewField object representing the Photo card field.
    string colPhotoFieldName = layoutView1.Columns["Photo"].LayoutViewField.Name;
    // The name of the Contact Info group.
    string groupContactInfoName = "contactInfoGroup";
    // Show the ContactInfo group only in the focused card
    e.CardDifferences.AddItemDifference(groupContactInfoName, 
        LayoutItemDifferenceType.ItemVisibility, (layoutView1.FocusedRowHandle == e.RowHandle));
    // Display the Photo field if the corresponding flag is set.            
    e.CardDifferences.AddItemDifference(colPhotoFieldName, 
        LayoutItemDifferenceType.ItemVisibility, showPhoto);
}
See Also