Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
920
HOWTO get conditional formatting colour behaviour to match Excel
posted

Hi

I've implemented conditional formatting for a set of columns in WinGrid 19.1 using the following code.

        Dim condition1 As New OperatorCondition(ConditionOperator.GreaterThan, 120)

        Dim appearance1 As Appearance = New Appearance()
        'Dim appearance2 As Appearance = New Appearance()

        appearance1.BackColor = color
        appearance1.BackColor2 = Color.White

        'appearance2.BackColor = Color.FromArgb(255, 199, 206)
        'appearance2.BackColor2 = Color.White

        Dim valAppearance1 As New ConditionValueAppearance()
        valAppearance1.Add(condition1, appearance1)

I'd like to achieve the same behaviour for colours as show below in Excel where colour are darker for higher value.  How do I specify this behaviour on the grid.

Any help greatly appreciated.

Many Thanks

James O'Doherty

Solution Architect

WinSQL Development Ltd

Parents
No Data
Reply
  • 34810
    Offline posted

    Hello James,

    I have been investigating into the behavior you are looking to achieve, and unfortunately, I believe you are going to have a difficult time doing this with the conditional formatting options on the UltraGrid. This is because these options do not contain the ability to have a “range color formatting” like you see in Excel.

    Instead, an alternative solution to this could be that you can handle the InitializeRow event of the UltraGrid and access the cells that you wish to color based on your condition from the UltraGridRow that is passed to the event arguments of this event. In this case, you would need to know what the minimum and maximum values are, and you would assign an Appearance to the UltraGridCell.Appearance property based on the UltraGridCell.Value to essentially color the cells as a range.

    If you would like to see an implementation of a “range color format” like in Excel in the UltraGrid control in the future, I would recommend suggesting a new product idea for this at the Windows Forms Ideas Site, here. This will place you in direct communication with our product management teams who plan and prioritize upcoming features and development based on community and user feedback.

    Please let me know if you have any other questions or concerns on this matter.

Children
No Data