Assigning Individual Cell Styles in FlexGrid

ComponentOne grids are relied upon by banks and other financial institutions for high-performance, high-throughput data visualization. In the case where near-real-time visual display of large amounts of data is required, such as with the high-volume display of stock market transactions, effective utilization of UI controls becomes imperative. This post shows how to change the style of a specific grid cell. Typical grid usage dictates that styles are shared by many cells. If they are, then changing the style will affect all the cells that it applies to. However, in some cases, when a style is modified, only the specific cell that owns the style will be modified. The attached sample creates individual styles for each cell. This allows users to modify the style of any cell without affecting any other cells. When the user clicks a button in the toolstrip, the sample enumerates all the individual cells in the selected range. The sample does this using this code:

// create a brand new style for this cell  

 var newStyle = _flex.Styles.Add(null);  

 // initialize it from the original style  


 // assign the new style to the range  

rng.Style = newStyle;  

You can download a working copy of this sample here:


GrapeCity Developer Tools
comments powered by Disqus