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
540
AppStylist with Infragistics Grids
posted

I have several different types of Grids in my application.  Some display data rows from which the user choosers a row,  Others are simply for display - there is nothing to select.  Others allow the user to edit data in the grid.  Some allow single row selection.  Some allow multiple row selection.  Some have one column of data that can be edited, etc.

I can't seem to find a way to define my color theme to display colors logically to a user in all these cases.  What do you suggest?

Is there a way to define multiple color "themes" for a grid within the same theme?

An example of a need for a difference is with defining hover and selected colors.

If not, how do you suggest this be handled.  I currently have a grid that displays multiple rows of data.  Each row has a trashcan icon that when clicked will cause the row to be deleted.  The user can also select multiple rows and press a button to delete those rows.

The theme defines a hover color for cells in the grid and also selected colors, which looks great for other grids, but looks weird with this grid since data can not be edited. 

One possible solution I can think of is to create multiple classes derived from the UltraGrid and style them independently.  Does the AppStylist allow for the styling of these sort of classes?

If not, what do you suggest?

Andy

  • 28950
    Offline posted

    Hello Andy,

    I have been investigating into your requirement in this case, and there are a few ways that this can be handled. It is first worth noting that by using AppStylist, you can define a style for each of the states of the grid – that is, for selection, hover, active, and a normal state by modifying the Normal, Selected, HotTracked, and Active states of the row styles.

    If you need multiple styles within the same .isl, I would recommend potentially using Resources, which you can read about here. You can then apply those Resources by using the StyleResourceName property of the various Appearance objects that are applied to the grid.

    Another thing you can do is create UserControls for the grids that you wish to have styled separately and then load your own .isl local to that UserControl. Alternatively, creation of a derived UltraGrid will be styled by AppStylist, but you will need to still write the actual style for UltraGrid to have it applied – there is no UI canvas for styling a custom-derived control.

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

  • 467410
    Offline posted

    In a case like there, were it seems like you have a few distinct 'cases' or types of grids, the best way to handle it is probably to use StyleSets. 

    In AppStylist, you can open up your Style Library and there's a Default StyleSet that applies to everything. You could then define only the grid settings that you want to apply to ALL grids in the default StyleSet. 

    Then you can create additional StyleSets: one for each particular grid 'case'. So one for the editable grids, one for the non-editable grids, etc. The StyleSet can be 'based on' the default styleset (in which case it will pick up all the settings on the styleset and then only the properties you set on that styleset with override the defaults) or not, it's up to you. 

    Then, in your application, you set the grid.StyleSetName to the name of the StyleSet you want.