Ticket T578847
Visible to All Users

How to Set Conditional Formatting (Rules) in TextBox

created 7 years ago

Hi,

I'm using the 16.2.8 dashboard designer and I have created a TextBox with a field. How do I set colour formatting (rules) to this field? For example,  if the field value is negative, the font colour is red while if the value is positive, the font colour is green. In Grid, we are able to set such rules but I do not see an option for TextBox. Kindly advise, thank you!

Answers approved by DevExpress Support

created 7 years ago

Hi,
At present, the Conditional Formatting feature supported only in the Grid and Pivot dashboard items, and cannot be used in the Text item. I have passed your request to our R&D team. We will take it into account when extending Conditional Formatting capabilities of our dashboards in the future.

    Show previous comments (3)
    DevExpress Support Team 7 years ago

      Though at present, this functionality is not supported, I can suggest you a workaround.

      Create a set of calculated fields which return the required value when the value meets a condition and null when it does not. For instance, if you wish to display summary values greater then 50k with the green color and values less then 50k, with a red color, create two calculated fields with the following expressions:
      LessThan50k calculated field:  Iif(Sum([ProductAmount]) > 50000, null, Sum([ProductAmount]))
      MoreThan50k calculated field: Iif(Sum([ProductAmount]) <= 50000, null, Sum([ProductAmount]))

      Then, add both these fields to the Text Item and apply different styles as in the following image:

      Since null values are not displayed in the Text Item, only one of these calculated fields will be displayed at the same time in your application. So, you will get the behavior illustrated in the following screencast.

        Thanks, this is what I need for the time being as a workaround!

        DevExpress Support Team 7 years ago

          You are welcome. I am happy to hear that you have found my assistance helpful.

          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.