aspnet-404551-troubleshooting-theme-related-issues-theme-is-not-applied-to-descendant.md
According to ASP.NET theming concepts, the tag name in a skin file should equal to the control class name. Once you create control class descendant, the existing skin file is no longer applied.
Since DevExpress ASP.NET controls use the standard ASP.NET theming approach (skin files) internally, the above-mentioned issue with descendants also affect these controls.
You can use the following approaches to resolve this issue.
WebUserControl with a DevExpress ASP.NET control inside.WebUserControl properties and manipulate them outside the WebUserControl.Implement a factory method instead of a control descendant. In this case, theming is applied without extra steps because the control’s class name is not changed.
public ASPxGridView GetASPxGridViewWithDefaultSettings(string ID) {
ASPxGridView grid = new ASPxGridView();
grid.ID = ID;
grid.ClientInstanceName = ID;
//...
return grid;
}
using System;
using System.Web.UI.WebControls;
namespace CustomControls {
public class MyButtonHasOwnSkin : Button { ... }
}
<%@ Register TagPrefix="cc" Namespace="CustomControls" %>
<cc:MyButtonHasOwnSkin runat="server" BackColor="Purple" />
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Theme="RedTheme" %>
<%@ Register TagPrefix="cc" Namespace="CustomControls" %>
@* ... *@
<asp:Button ID="Button1" runat="server" Text="Default ASP.NET Button" />
<cc:MyButtonHasOwnSkin ID="Button3" runat="server" Text="Custom ASP.NET Button Has Own Skin" />