Skip to main content
.NET 8.0+

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

ViewVariantsModule.VariantsProvider Property

Specifies the IVariantsProvider object that provides a list of view variants available for the specific View, and stores the variant selected by user.

Namespace: DevExpress.ExpressApp.ViewVariantsModule

Assembly: DevExpress.ExpressApp.ViewVariantsModule.v24.2.dll

#Declaration

[Browsable(false)]
public IVariantsProvider VariantsProvider { get; set; }

#Property Value

Type Description
IVariantsProvider

An IVariantsProvider object that provides a list of view variants available for the specific View, and stores the variant selected by the user.

#Remarks

The VariantsProvider property is used by the ViewVariantsModule class to initialize the ViewVariantsModule.FrameVariantsEngine property and by the CustomizeNavigationItemsController class to build additional navigation nodes for view variants. By default, a ModelVariantsProvider object is assigned to the VariantsProvider property when the XafApplication.SetupComplete event occurs if this property is not yet initialized. Add a class that implements the IVariantsProvider interface and assign an instance of this class to the VariantsProvider property if you want to replace the standard behavior.

public sealed partial class MySolutionModule : ModuleBase {
    public override void Setup(XafApplication application) {
        base.Setup(application);
        application.SetupComplete += application_SetupComplete;
    }
    void application_SetupComplete(object sender, EventArgs e) {
        Application.Modules.FindModule<ViewVariantsModule>().VariantsProvider = new DatabaseViewVariantsProvider(Application);
    }
    // ...
}

The DatabaseViewVariantsProvider class is used in the snippet above. This class implementation is demonstrated in the IVariantsProvider topic.

See Also