Breaking Change T1230710
Visible to All Users

Blazor - The ListEditor.Control, PropertyEditor.Control, and ViewItem.Control properties return Component Models instead of Adapters

What Changed

In v24.1+, the ViewItem.Control and ListEditor.Control properties of all built-in List Editors, View Items, and Property editors return a corresponding Component Model instead of an Adapter.

For example:

  • DxGridListEditor.Control returns GridModel instead of DxGridAdapter
  • DateTimePropertyEditor.Control returns DxDateEditModel instead of DxDateEditAdapter
  • ReportDesignerViewItem.Control returns DxReportDesignerModel instead of DxReportDesignerAdapter

Reasons for Change

This change aims to improve user experience with XAF Blazor and make it more in line with other platforms (ASP.NET Web Forms and Windows Forms). User feedback indicated that interaction with List and Property Editors in XAF Blazor was more challenging compared to other platforms. Removal of Adapters allows customers to interact with Component Models directly.

Impact on Existing Apps

This change affects the Control return type of all built-in List Editors, View Items, and Property Editors.

How to Update Existing Apps

To update existing applications, refactor code that accesses List/Property Editor's Adapter instances and use the corresponding Component Model classes instead. For example:

List Editor:

C#
protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); //Before if(View.Editor is DxGridListEditor gridListEditor && gridListEditor.Control is IDxGridAdapter adapter) { adapter.GridModel.PagerVisible = false; adapter.GridDataColumnModels.First(c => c.FieldName == "FirstName").AllowSort = false; } //Now if(View.Editor is DxGridListEditor gridListEditor) { gridListEditor.GridModel.PagerVisible = false; gridListEditor.GridDataColumnModels.First(c => c.FieldName == "FirstName").AllowSort = false; } }

Property Editor:

C#
protected override void OnActivated() { base.OnActivated(); //Before View.CustomizeViewItemControl<DateTimePropertyEditor>(this, (propertyEditor) => { if(propertyEditor.Control is DxDateEditAdapter adapter) { adapter.ComponentModel.DropDownVisible = false; } }); //Now View.CustomizeViewItemControl<DateTimePropertyEditor>(this, (propertyEditor) => { propertyEditor.ComponentModel.DropDownVisible = false; }); }

Adapter-Based Approach in Custom Property Editors

The adapter-based approach remains applicable. However, ensure that any class that inherits from ComponentAdapterBase overrides the ComponentModel property and returns a non-null value.

C#
public class InputAdapter : ComponentAdapterBase { public InputAdapter(InputModel componentModel) { ComponentModel = componentModel; } // ... public override InputModel ComponentModel { get; } }

How to Revert to Previous Behavior

In the SolutionName.Blazor.Server/Program.cs file of your ASP.NET Core Blazor application project, set FrameworkSettings.DefaultSettingsCompatibilityMode to the previous version or set the DevExpress.ExpressApp.Blazor.BlazorApplication.UseComponentModel property value to false:

C#
public static int Main(string[] args) { DevExpress.ExpressApp.FrameworkSettings.DefaultSettingsCompatibilityMode = DevExpress.ExpressApp.FrameworkSettingsCompatibilityMode.v23_2; // or DevExpress.ExpressApp.Blazor.BlazorApplication.UseComponentModel = false; }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.