Ticket T857285
Visible to All Users

How to change a progress bar's color conditionally based on its value

created 5 years ago (modified 5 years ago)

[DevExpress Support Team: CLONED FROM T246223: How can I implement a progress bar in the ListView grid column and DetailView editor for both Windows and Web?]

Hello!
I find this editor very useful, but I would like to know if there's a way to apply conditional appearance to it. Indeed, I would like to color the progress bar from red to green, based on the completion percentage.

Answers approved by DevExpress Support

created 5 years ago

Hello Matteo,

Our WinForms and ASP.NET progress bar controls mentioned in this article allow you to change their indicator color. In WinForms, there are special StartColor and EndColor properties - see ProgressBarControl Class. In ASP.NET, change the ASPxProgressBar.IndicatorStyle.BackColor property based on the control's value. See an example at ASPxGridView - How to implement ASPxProgressBar in DataCell with a custom color.

    Comments (2)
    ML ML
    Matteo Lazzari 5 years ago

      Thank you. I'll go with a controller, but an AppearanceRule would be appreciated.

      Anatol (DevExpress) 5 years ago

        You can support the Conditional Appearance module in your custom Property Editor by implementing the IAppearanceFormat interface. Its IAppearanceFormat.BackColor property should get and set the corresponding control value (e.g., ASPxProgressBar.IndicatorStyle.BackColor).

        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.