Ticket T1243383
Visible to All Users

Re: Blazor - How to show a fully custom non-XAF web page (with custom controls, JavaScript, Razor components, etc.)

created 7 months ago

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; } [...]

Answers approved by DevExpress Support

created 7 months ago

Hello Kyle,

Thank you for the code samples.

We appreciate your contribution to our knowledge base. I updated the original ticket with a link to this ticket.

Best regards,
Herman

    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.