Ticket T322673
Visible to All Users

Changing the font size for particular ListView, Detail View, Custom Detail View and Popup's of ASP.NET web application

created 9 years ago

I have a requirement to show bigger font for a particular List View, Detail View and Popup's and all the controls inside it. Those might be a AspxGridView or Custom Property or Item Templates. Mine is Web Application not Windows.

I have tried with Different options with no luck.
A2761
Q485788

I have some style sheet options but not finding the exact details where to specify those items for these particular controls.

Answers approved by DevExpress Support

created 9 years ago

Hello,

There are two ways of changing the font size in ASP.NET - by changing font settings of individual controls or by changing default styles in CSS. In the second case, these changes will be applied to all views, so this solution will be unlikely appropriate for you. Just in case, review the How can i change default font in web application? ticket.
Regarding the first solution, here are help topics describing how to access and customize certain View controls:
Access Grid Control Properties
Access Editor Settings
How to: Customize an ASP.NET Template

See examples of how to change font settings in the following tickets:

How to change a property editor's font size and color in ASP.NET
set font size of detailview group header
Change Font Family and Size for All DevExpress.ExpressApp.Web.Editors.ASPx.ASPxStringPropertyEditor Controls

Feel free to contact us if you need further assistance.

    Show previous comments (5)
    Anatol (DevExpress) 9 years ago

      You can change the font size in these controls using the WebControl.Font property. Here is an example:

      C#
      public class ChangePropertyEditorFontController : ObjectViewController<DetailView, Contact> { protected override void OnActivated() { base.OnActivated(); foreach (WebPropertyEditor propertyEditor in View.GetItems<WebPropertyEditor>()) { propertyEditor.ControlCreated += propertyEditor_ControlCreated; } } void propertyEditor_ControlCreated(object sender, EventArgs e) { WebPropertyEditor propertyEditor = (WebPropertyEditor)sender; WebControl control; if (propertyEditor.ViewEditMode == ViewEditMode.View) { control = propertyEditor.InplaceViewModeEditor; } else if (propertyEditor is ASPxLookupPropertyEditor) { control = (WebControl)((ASPxLookupPropertyEditor)propertyEditor).DropDownEdit.DropDown ?? ((ASPxLookupPropertyEditor)propertyEditor).FindEdit; } else { control = propertyEditor.Editor; } if (control != null) { control.Font.Size = FontUnit.Large; } } protected override void OnDeactivated() { base.OnDeactivated(); foreach (WebPropertyEditor propertyEditor in View.GetItems<WebPropertyEditor>()) { propertyEditor.ControlCreated -= propertyEditor_ControlCreated; } } }
      DE DE
      Dev Express 28 9 years ago

        Thanks Anatol for your support. That Helps a lot.
        Is there some way that to increase the Font of a ListView, which is appearing in different places. One place it has to show the normal font as it is through out the application. Another place it has to show with a different font Size?

        Anatol (DevExpress) 9 years ago

          Yes, this is possible. You can access this ListView from a controller of its parent DetailView, as described here: How to access a nested ListView from the parent DetailView's controller and parent DetailView from the nested ListView's controller. In this case, only the ListView displayed in this DetailView will be customized.
          Alternatively, clone the required view model in the Model Editor, use the cloned model for the required collection property and create a ViewController that changes only list views with this model.

          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.