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
140
Defining alternative row, column, and cell styles in AppStylist
posted

We have grids that require different visual appearance for specific rows, columns, or cells.  Our initial approach was to define additional styles in the DisplayLayout.Appearances collection using the designer.  At runtime, we can set the appearance of a row, cell, or column to one of these additional appearances based on data or other factors.

However, we now need for these styles to vary by the AppStylist style file in use.  In other words, what these additional appearances actually looks like should be defined in the style file, not the designer.  When and where they apply will still be defined in the program code.

For simple controls, we can set the control's StyleSetName and have an additional style set defined in the AppStylist style file.  But for the UltraGrid, this would change the styles applied to the entire grid, not to individual rows, columns, or cells.

How can we define appearances in the style file that we can then programmatically apply to specific rows, columns, or cells?

  • 7555
    Verified Answer
    Offline posted

    Hello Scott,

    Thank you for your post. The AppStylist is agnostic of individual objects so you can't define the conditions in AppStylist. You have to do that in code.

    What you can do, in a case like this, is use resources. A resource is like an Appearance. You can defined a resource in the application style library in AppStylist. Then you assign that resource to a specific object in the grid like a cell or a row by resource name:

    this.ultraGrid1.Rows[0].Appearance.StyleResourceName = "My Resource defined in the style library";

    The StyleResourceName is a property on the Appearance object so it exists on every Appearance property like the row.Appearance, cell.Appearance. column.CellAppearance, etc.

    Let me know if you need further assistance.

    Sincerely,
    Divya Jain