Hi Support,
How do I set the font size of detailview's group header text? Thanks.
We have closed this ticket because another page addresses its subject:
How can I change a layout group caption in a web controller?Hi Support,
How do I set the font size of detailview's group header text? Thanks.
Hello Shiela,
You can use the WebLayoutManager.ItemCreated event to access the control displaying this text and change its font settings. Here is an example:
C#public class ChangeLayoutGroupCaptionViewController : ObjectViewController<DetailView, Contact> {
protected override void OnActivated() {
base.OnActivated();
((WebLayoutManager)View.LayoutManager).ItemCreated += ChangeLayoutGroupCaptionViewController_ItemCreated;
}
void ChangeLayoutGroupCaptionViewController_ItemCreated(object sender, ItemCreatedEventArgs e) {
if (e.ModelLayoutElement is IModelLayoutGroup) {
e.TemplateContainer.Load += (s, args) => {
if (e.TemplateContainer.CaptionControl != null) {
e.TemplateContainer.CaptionControl.Font.Size = new FontUnit(10);
}
};
}
}
protected override void OnDeactivated() {
base.OnDeactivated();
((WebLayoutManager)View.LayoutManager).ItemCreated -= ChangeLayoutGroupCaptionViewController_ItemCreated;
}
}
How can I set the size for this code? Thanks.
((System.Web.UI.WebControls.Literal)e.TemplateContainer.CaptionControl.Controls[0])
You can use the CaptionControl.Font.Size property for this purpose. I have added an example to my answer.
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.