Description:
I am trying to change the "X" property of the "Y" control, but not able to. At design time, this property is applied properly, but my changes are not in effect when I run my application. Note that I use the Theme property for the site.
Answer:
This issue is caused by the fact that our skin files rewrite some control properties (i.e. ASPxMenu.ItemImagePosition, ASPxRoundPanel.ContentPaddings, etc.). When you apply a theme to a page or site using the Theme property, remember that control properties declared in a corresponding skin file have higher priority. However, there are several ways to solve this issue.
1. Apply the theme using the StyleSheetTheme property. This way, the control markup on a page overwrites properties declared in the skin file. For example:
XML<devExpress>
<themes enableThemesAssembly="true" styleSheetTheme="Aqua" />
</devExpress>
or
ASPx<pages ... styleSheetTheme="Aqua">
Referring to MSDN, I would like to say that the StyleSheetTheme property specifies the name of a theme that is applied to a page early in the page life cycle, whereas the Theme property specifies the name of a theme that is applied to a page later in the page life cycle. This means that settings on the page have higher priority than settings in the style sheet theme.
2. Create a new theme based on the default one using the ASPxThemeBuildrer tool and re-define required properties. Here is a link to the help topic:
Creating a New Theme: Modify Theme
3. Create a custom skin with ASPxThemeBuilder. Re-define the required properties in this skin file and set the new skin ID to the control's SkinIDproperty.
4. Set the necessary properties in the control's Init event handler. For example:
C#protected void dv_Init(object sender, EventArgs e) {
ASPxDataView dv = (ASPxDataView)sender;
dv.PagerSettings.ShowNumericButtons = false;
}
Visual BasicProtected Sub dv_Init(sender As Object, e As EventArgs)
Dim dv As ASPxDataView = DirectCast(sender, ASPxDataView)
dv.PagerSettings.ShowNumericButtons = False
End Sub
For information, see the following topics:
How to: Apply ASP.NET Themes
How to: Apply ASP.NET Themes Programmatically
Apply a Theme with the ASP.NET Mechanism
Apply a Theme with the DevExpress Mechanism