This isn't really a support request, this is in lieu of not being able to add a comment or reply directly to the other ticket.
The example provided by support in this is very useful, concise, and to the point. It is however outdated and the documentation surrounding updating to the latest (v24), and dealing with specifically a breaking issue around ComponentAdapterBase is a little thin. Sorry if this stuff is obvious or rudimentary, the Blazor stack is still very new to me.
I had to make a couple minor changes to the code example to get it working for the current version, here they are:
WelcomeComponentAdapter.cs (Implement ComponentAdapterBase, change where the application title comes from, fix up some of the component model rendering related stuff)
C#using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Blazor.Components.Models;
using DevExpress.ExpressApp.Blazor.Editors.Adapters;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Utils;
using Microsoft.AspNetCore.Components;
using static System.Net.Mime.MediaTypeNames;
namespace RazorPageInsideMainWindow.Blazor.Server.Components
{
public class WelcomeComponentAdapter : ComponentAdapterBase
{
private RenderFragment component;
public WelcomeComponentAdapter()
{
}
public RenderFragment ComponentContent
{
get
{
if (component == null)
{
component = builder =>
{
builder.OpenComponent<WelcomeComponent>(0);
builder.AddAttribute(1, nameof(WelcomeComponent.Title), RazorPageInsideMainWindowBlazorApplication.Current.Title);
builder.CloseComponent();
};
}
return component;
}
}
public override IComponentModel ComponentModel => throw new NotImplementedException();
public override object GetValue()
{
return null;
}
public void Refresh()
{ }
public override void SetAllowEdit(bool allowEdit)
{
throw new NotImplementedException();
}
public override void SetAllowNull(bool allowNull)
{
throw new NotImplementedException();
}
public override void SetDisplayFormat(string displayFormat)
{
throw new NotImplementedException();
}
public override void SetEditMask(string editMask)
{
throw new NotImplementedException();
}
public override void SetEditMaskType(EditMaskType editMaskType)
{
throw new NotImplementedException();
}
public override void SetErrorIcon(ImageInfo errorIcon)
{
throw new NotImplementedException();
}
public override void SetErrorMessage(string errorMessage)
{
throw new NotImplementedException();
}
public override void SetIsPassword(bool isPassword)
{
throw new NotImplementedException();
}
public override void SetMaxLength(int maxLength)
{
throw new NotImplementedException();
}
public override void SetNullText(string nullText)
{
throw new NotImplementedException();
}
public override void SetValue(object value)
{
}
protected override RenderFragment CreateComponent()
{
return ComponentContent;
}
}
}
BlazorApplication.cs (add static accessor property for the XafApplication object)
C#public class RazorPageInsideMainWindowBlazorApplication : BlazorApplication {
public static RazorPageInsideMainWindowBlazorApplication Current { get; private set; }
public RazorPageInsideMainWindowBlazorApplication() {
ApplicationName = "RazorPageInsideMainWindow";
CheckCompatibilityType = DevExpress.ExpressApp.CheckCompatibilityType.DatabaseSchema;
DatabaseVersionMismatch += RazorPageInsideMainWindowBlazorApplication_DatabaseVersionMismatch;
RazorPageInsideMainWindowBlazorApplication.Current = this;
}
[...]