Ticket Q254058
Visible to All Users

display a field as bold

created 15 years ago

Hi,
How do I decorate a field or a label with display attributes eg. Bold, Font size change etc.
Thanks
Jeejee

Comments (1)
DevExpress Support Team 15 years ago

    Hi Jeejee,
    To accomplish this task, you should access (in a platform-dependent manner) the layout manager using the DetailView.LayoutManager property.
    In a WinForms application, you should override the WinApplication.CreateLayoutManagerCore method, and return a custom WinLayoutManager descendant. In the custom WinLayoutManager override the CreateControlItem method, and adjust the LayoutControlItem.AppearanceItemCaption property members. Alternatively, in a detail view controller you can handle the WinLayoutManager.ItemCreated event, and adjust layout item properties. For example:

    C#
    public class ViewController1 : ViewController { public ViewController1() { TargetViewType = ViewType.DetailView; } protected override void OnActivated() { base.OnActivated(); WinLayoutManager lm = ((DetailView)View).LayoutManager as WinLayoutManager; lm.ItemCreated += new EventHandler<ItemCreatedEventArgs>(lm_ItemCreated); } void lm_ItemCreated(object sender, ItemCreatedEventArgs e) { LayoutControlItem item = e.Item as LayoutControlItem; if (item == null) return; item.AppearanceItemCaption.Font = new System.Drawing.Font(item.AppearanceItemCaption.GetFont(), System.Drawing.FontStyle.Bold); } }

    In a Web application, changes can be applied at the time the layout item is being created by creating a descendant of the LayoutItemTemplate, and assigning it to the WebLayoutManager.LayoutItemTemplate property.
    Please also refer to the following examples:
    How to highlight the focused editor in DetailView,
    Change css for specific group,
    How can I change a layout group caption in a web controller?.
    Thanks,
    Michael.

    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.